source file name: BinaryConv.C
void main()
{
int i,n;
int rem[15];;
clrscr();
printf("enteu any Natural number :\n");
scanf("%d",&n);
i=0;
while(n>0)
{
rem[i]=n%2;
n=n/2;
i++;
}
printf("\nBinary Conversion :\n");
for(i=i-1;i>=0;i--)
printf("%d ",rem[i]);
getch();
}
output:
0 Comments
Post a Comment