Write a ‘C’ program to convert given decimal number into binary number.
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i=0,n,j;
clrscr();
printf("enter the no");
scanf("%d",&n);
while(n>0)
{
a[i]=n%2;
n=n/2;
i++;
}
for(j=i-1;j>=0;j--)
{
printf("%d",a[j]);
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i=0,n,j;
clrscr();
printf("enter the no");
scanf("%d",&n);
while(n>0)
{
a[i]=n%2;
n=n/2;
i++;
}
for(j=i-1;j>=0;j--)
{
printf("%d",a[j]);
}
getch();
}