Code:
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
int a;
int y;
a=16;
y=a%2;
a=a/2;
while((a)!=0)
{
cout<<y;
y=a%2;
a=a/2;
}
cout<<y<<endl;
return 0;
}
integer 16 has its binary represantation as
10000
but the program that i have written gives the output as
00001
how can i reverse my output
and the second problem is that i want the output to be in 32 bit binary representation which i am not able to get how can i alter the program to get the output this way
integer 16 as
0000 0000 0000 0000 0000 0000 0001 0000
help me alter this program
please help as

