Wednesday, 19 August 2015

Programming in C to convert the Decimal number to Binary digits

#include<stdio.h>
#include<conio.h>
void main()
{
int x,y=40;
clrscr();
printf("Enter a number:");
scanf("%d",&x);
printf("\n Binary number:");
while(x!=0)
{
gotoxy(y--,3);
printf("%d",x%2);
x=x/2;
}
getch();
}

No comments:

Post a Comment