Home > Back-end >  programming
programming

Time:10-16

How to use programming is converted into binary, the output of the input a decimal use while statement, as simple as possible, thank you
For example:
#include
Void main ()
{
Int a, b, d;
While (a % 2!=0)
{
B=a/2;
D=a % 2;
A=b;
}
Printf (" % d ", d);
}
Where the program is wrong, on this foundation how to change, thank you

CodePudding user response:

This sentence while (a % 2!=0) obviously wrong
When a==2?
Directly to the while (a!=0)

CodePudding user response:

This should not be on int, but should be aimed at unsigned, at least into unsigned calculation,