Program to print Binary Equivalent of a number
#include<stdio.h> #include<stdlib.h> #include<string.h> main() { int num,bit=0; printf("enter a number\n"); scanf("%d",&num); l1: num&(1<<bit)?printf("1"):printf("0"); bit++; if(bit<=31) goto l1; printf("\n"); }OutPut:
enter a number 12 00110000000000000000000000000000 (for big endian machine)