how to print binary in c code example
Example: print binary in c
#include <iostream>
using namespace std;
int main() {
long n, d, r, binary = 0;
n=10;
d = n;
int temp = 1;
while (n!=0) {
r = n%2;
n = n / 2;
binary = binary + r*temp;
temp = temp * 10;
}
printf("%ld", binary);
return 0;
}