//Program to convert decimal to binary.
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int num,r,n,i=-1,k,a[20];
clrscr();
printf("program to convert decimal to binary");
printf("\n Enter the number: ");
scanf("%d",&num);
while(num>0)
{
i=i+1;
r=num%2;
num=num/2;
a[i]=r;
}
printf("The binary equivalent is= ");
for(k=i;k>=0;k--)
printf("%d",a[k]);
getch();
}
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int num,r,n,i=-1,k,a[20];
clrscr();
printf("program to convert decimal to binary");
printf("\n Enter the number: ");
scanf("%d",&num);
while(num>0)
{
i=i+1;
r=num%2;
num=num/2;
a[i]=r;
}
printf("The binary equivalent is= ");
for(k=i;k>=0;k--)
printf("%d",a[k]);
getch();
}