Aug 23, 2010

Decimal To Binary Converter

//This Is The Program To Convert Decimal To Binary But Its Different From Other Ones!
#include<stdio.h>
void printBinary(int n);
void main()
{
int num;
printf("Enter Decimal Number\n");
scanf("%d",&num);
printBinary(num);
}
void printBinary(int n)
{
if (n>0)
{
printBinary(n/2);
printf("%c","01"[n%2]);
}
}