Write a program to convert decimal to binary.
#include<stdio.h>
#include<conio.h>
main()
{
int i,dec,a[20];
clrscr();
scanf("%d",&dec);
i=0;
while(dec!=0)
{
a[i]=dec%2;
dec=dec/2;
i++;
}
int j=i-1;
while(j>0)
{
printf("%d ",a[j]);
j--;
}
getch();
}
#include<conio.h>
main()
{
int i,dec,a[20];
clrscr();
scanf("%d",&dec);
i=0;
while(dec!=0)
{
a[i]=dec%2;
dec=dec/2;
i++;
}
int j=i-1;
while(j>0)
{
printf("%d ",a[j]);
j--;
}
getch();
}