how to print a number base 2 in c code example
Example 1: print digits of a number in c
#include <stdio.h>
int main(){
int num = 1024;
while(num != 0){
int digit = num % 10;
num = num / 10;
printf("%d\n", digit);
}
return 0;
}
Example 2: how to print int in c
#include <stdio.h>
int main() {
int number;
printf("Enter an integer: ");
scanf("%d", &number);
printf("You entered: %d", number);
return 0;
}