C program Decimal to Binary conversion

This Programs does decimal to binary conversion. This is a part of Mumbai University MCA Colleges C programs  Sem 1


#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();
}



Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

No comments:

Post a Comment