Write a C program to convert Decimal to Binary conversion without using inbuilt functions

Questions by shivaram.cunchala

Showing Answers 1 - 1 of 1 Answers

Syed Baseer Ahmed

  • Jun 8th, 2007
 

void printBinary(int n)
{
if (n>0)
{
printBinary(n/2);
printf("%c","01"[n%2]);
}
else
{
printf("n");
}
}
int main()
{
int num;
printf("Enter the number in decimal");
scanf("%d",&num);
printf("The binary equivalent of %d is  ",num);

printBinary(num);
getch();
return 0;
}


  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Answer Question

Click here to Login / Register your free account


 
Send   Reset

 

Related Answered Questions

 

Related Open Questions