# Include <stdio. h>
# Include <conio. h>
# Include <math. h>
Void main ()
{
Int num, N, I, B [8];
Printf ("Please input a integer number :");
Scanf ("% d", & num );
For (I = 1; I <8; I ++)
{
N = POW (2, I);/** // * The POW passes debugging in BC/TC. The system automatically forces the conversion, but an error occurs in VC, the parameter must be double or float */
B [I] = (Num/n) % 2;
}
For (I = 7; I> = 0; I --)
Printf ("% d", B [I]);
Getch ();
}
# Include <stdio. h>
# Include <conio. h>
Void main ()
{
Int m, n = 2, I = 0, J, a [8];
Printf ("Please input a integer number (M> = 0 and M <= 255 ):");
Scanf ("% d", & M );
While (M <0 & amp; M & gt; 255)
{
Printf ("Please input a number (M> = 0 and M <= 255 ):");
Scanf ("% d", & M );
}
While (M! = 0)
{
A [I] = m % 2;
I ++;
M = m/2;
}
For (j = 0; j <8-I; j ++)
Printf ("0 ");
For (j = I-1; j> = 0; j --)
Printf ("% d", a [J]);
Getch ();
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.