Binary format,C binary format,given number in binary format,print in binary format,binary format in C,Print the given number in binary format using in C program language,C program binary format,print in binary format,print the given number in binary,binary format of given number
Binary format of given number
This one is for print the given number in binary format.
#include<stdio.h>
main()
{
int n,pos;
printf("Enter number\n");
scanf("%d",&n);
for(pos=31;pos>=0;pos--)
{
if((n&(1<<pos))==0)
printf("0");
else
printf("1");
}
}
Output:-
Enter number
5
00000000000000000000000000000101
Binary format of given number
This one is for print the given number in binary format.
#include<stdio.h>
main()
{
int n,pos;
printf("Enter number\n");
scanf("%d",&n);
for(pos=31;pos>=0;pos--)
{
if((n&(1<<pos))==0)
printf("0");
else
printf("1");
}
}
Output:-
Enter number
5
00000000000000000000000000000101
0 comments:
Post a Comment