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 is floating point constants?
Can you return null in c?
What is const volatile variable in c?
A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers
c program for searching a student details among 10 student details
How do I send escape sequences to control a terminal or other device?
write a program in c language to print your bio-data on the screen by using functions.
What is self-referential structure in c programming?
What is the argument of a function in c?
can anyone suggest some site name..where i can get some good data structure puzzles???
What is a loop?
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555
Why do we need arrays in c?
Are enumerations really portable?