#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,a[8],rem;
clrscr();
printf("Enter any decimal number::\n");
scanf("%d",&n);
for(i=7;i>=0;i--)
{
rem=n%2;
a[i]=rem;
n=(int)n/2;
}
printf("\nThe binary number is=");
for(i=0;i<8;i++)
printf("%d",a[i]);
getch();
}
#include<conio.h>
void main()
{
int i,n,a[8],rem;
clrscr();
printf("Enter any decimal number::\n");
scanf("%d",&n);
for(i=7;i>=0;i--)
{
rem=n%2;
a[i]=rem;
n=(int)n/2;
}
printf("\nThe binary number is=");
for(i=0;i<8;i++)
printf("%d",a[i]);
getch();
}
program is wrong
ReplyDelete