How to convert decimal to binary in C using recursion??
Answer Posted / rajaas tahir
# include <stdio.h>
#include<conio.h>
void Bin (int num);
int main (void)
{
int num;
int base;
printf ("Enter the decimal number to convert it binary.\n");
scanf ("%d", &num);
printf ("The %d in binary is : ", num);
Bin (num);
getch();
}
void Bin (int num)
{
int a, b;
a=num/2;
if ((a!= 0) && (num > 1))
{
printf("%d",(num%2));
Bin (num / 2);
}
}
| Is This Answer Correct ? | 3 Yes | 14 No |
Post New Answer View All Answers
What are the 5 data types?
What is the mean of function?
to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?
Where is volatile variable stored?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
What is the difference between typedef and #define?
What is the right type to use for boolean values in c?
What is the significance of c program algorithms?
The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?
What is a void pointer in c?
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
what do the 'c' and 'v' in argc and argv stand for?
How will you declare an array of three function pointers where each function receives two ints and returns a float?
What type is sizeof?
Explain how to reverse singly link list.