Hi all !
I'm new in this forum, and also totally new in c programming. My code displays a binary after entering an int. I would like to suppress the leading zeros... Here is the code:
Code:#include <stdio.h> void printBin(); int main() { int dec; printf("\n Enter a number : "); scanf("%d",&dec); printBin(dec); } void printBin(int num) { int i; for (i=0; i<32; i++) { if (num<0) { printf("1"); } else { printf("0"); } num = num << 1; } }