C program Decimal to Binary conversion

Ram Pothuraju
This Programs does decimal to binary conversion. 



#include
#include
void main()
{
int num,r,n,ar[100],count=0,i=0;
clrscr();
printf("Enter the number to convert");
scanf("%d",&num);
while(num!=0)
{
ar[i]=num%2;
num=num/2;
i++;
count++;
}

printf("The Binary form of this number is ");
for(i=(count-1);i>=0;i--)
{
printf("%d",ar[i]);
}
getch();
}
Tags

Post a Comment

0Comments

Post a Comment (0)