The decimal to binary bitwise is giving me output zero

#include
using namespace std;
void dec(int &n) {
int p=1;
int ans=0;
while(n>0) {
ans+=(n%2)p;
p=p
10;
n=n/2;

}
cout<<ans;

}

void dec2(int n) {
int ans=0;
int p=1;
while(n>0) {
ans=ans + (n&1)p;
p=p
10;

    n=n>>1;
}
cout<<ans;

}

int main() {
int n;
cin>>n;
dec(n);

cout<<endl;
dec2(n);




return 0;

}