0

How do I make a C program that converts decimal numbers in binary?

I can't figure out how to do it. From what I know I must use the do-while cycle.

17th May 2018, 8:13 AM
Giova Zeta
2 ответов
+ 1
If you know how to make the conversion using a pen and a paper, make the program do the same thing, the same steps you do.
17th May 2018, 8:45 AM
Ulisses Cruz
Ulisses Cruz - avatar
0
initialize s=0 and n=decimal number. Main logic behind conversion: while(n>0){ m=n%2; n=n/2; s=s*10+m; }
17th May 2018, 8:22 AM
Alpha Rays
Alpha Rays - avatar