#include <stdio.h>
int main()
{
int a = 10 ;
printf("Enter a number to print in binary format\n") ;
scanf("%d", &a) ;
while (a)
{
if (a&1 == 1)
printf("1") ;
else
printf("0") ;
a = a>>1 ;
}
printf("\n") ;
}
int main()
{
int a = 10 ;
printf("Enter a number to print in binary format\n") ;
scanf("%d", &a) ;
while (a)
{
if (a&1 == 1)
printf("1") ;
else
printf("0") ;
a = a>>1 ;
}
printf("\n") ;
}
No comments:
Post a Comment