my program prints binary in reverse order i.e for 10 it shouldprint 1010 but it
ID: 3613784 • Letter: M
Question
my program prints binary in reverse order i.e for 10 it shouldprint 1010but it prints 0101 plz help? rectify any error in my prg
my prg is
# include <stdio.h>
int main (void)
{
int num;
clrscr();
printf ("Enter the no: to be converted into binary ");
scanf ("%d",&num);
while (num != 0)
{
printf ("%d",num % 2);
num = num /2;
}
getch();
return 0;
} rectify any error in my prg
my prg is
# include <stdio.h>
int main (void)
{
int num;
clrscr();
printf ("Enter the no: to be converted into binary ");
scanf ("%d",&num);
while (num != 0)
{
printf ("%d",num % 2);
num = num /2;
}
getch();
return 0;
}