Thursday, August 27, 2015

DECIMAL TO BINARY CONVERSION IN C

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

Live Traffic

Popular Posts

Designed By RAJESH GOWRABATHUNI