Description:-
Enter the decimal number & this program gives u the binary equivalent number of that given decimal number.
For example:-
Enter the decimal number=2654
Binary equivalent=>
101001011110
Process:-
1. Copy the entire source code(Bold in format).
2. Paste that in your c or c++ compiler.
3. Save that with a suitable name.
4. Compile that program.
5. Finally run that program.
Error handling:-
Due to inappropiate html coding done by this web page I can't give the header file
name like stdio.h, conio.h, stdlib.h, iostream.h, fstream.h, iomanip.h etc.
If u get an error report after compiling the program
"CALL TO UNDEFINED FUNCTION 'PRINTF(OR ANYTHING)' IN FUNCTION MAIN()"
please add the above mentioned header file after #include
like #include
Disclaimer:-
If you have any other problem regarding the program please mail me.
My mail address is showing on my blog page.
Source code:-
#include
void main()
{
int x[100],i=0;
long n;
printf("Enter the number=>");
scanf("%ld",&n);
printf("\nBinary equivalent=>\n\n");
while(n!=0)
{
x[i]=n%2;
i++;
n=n/2;
}
for(n=(i-1);n>=0;n--)
printf(" %d ",x[n]);
}
Friday, 8 May 2009
Binary
Posted by san_shinee at 6:21 pm
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment