DECIMAL TO BINARY
#include<stdio.h>
void main()
{
int n,c,k;
printf("Enter the value to convert the decimal to binary");
scanf("%d",&n);
printf("%d in binary system is:",n);
for(c=31;c>=0;c--)
{
k=n>>c;
if(k&1)
printf("1");
else
printf("0");
}
}
OUTPUT:
No comments:
Post a Comment