C Program to Convert Decimal number to binary number

#include<stdio.h>
#include<conio.h>
void main() {
int num,b,bnum;
printf("Enter a Number ");
scanf("%d",&num);
while(num>0)
{
b=num%2;
num=num/2;
bnum=b;
printf("%d", bnum);

}
getch();
}

Leave a Reply