//1. The last digit of the odd number is 1, and the last digit of the even is 0, such as 5/2 is 2, so the next one is 0, if it is the next one is 1, if 6 is R = 6%2 >0, 6 is greater than or equal to 2 >6/2 >3, >r = 3%2 >1, the most After a bit and all are equal to n%2 so use recursion, R is the last value equals n%2, the next dividend equals N/2.//2. Unsigned is expressed in unsiged,%lu, the program used to unsiged long unsigned length, return 0 End program//?? pending problem, while (scanf ("%lu", &number) = = 1) temporarily understood as condition is true#include<stdio.h>//declaration of a functionvoidTo_binary (unsignedLongNumber );intMain (void) {printf ("Enter An integer (Q to quit): \ n"); unsignedLongNumber ; while((scanf ("%lu", &number) = =1) {printf ("Binary equivalent:\n"); To_binary (number); Putchar ('\ n'); printf ("Enter An integer (Q to quit): \ n"); } printf ("%lu\n", number); printf ("input done.\n"); return 0;}//implementation of the functionvoidTo_binary (unsignedLongN) { intR; R= n%2; if(n) {to_binary (n/2); Putchar (R?'1':'0'); return; }}
Binary Computing Program