Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to convert decimal to binary in C using recursion??

Answer Posted / jaguar

Please check the following program buddy,
Just save it as .c and run it you got what you want

# include <stdio.h>

void Rec_Dec_To_Bin (int num);

void main ()
{
int num;
int base;

printf ("Enter the decimal number to convert it binary.\n");
scanf ("%d", &num);


printf ("The number in decimal is : %d\n", num);
printf ("\n");

printf ("The %d in binary is : ", num);
Rec_Dec_To_Bin (num);

printf ("\n\n");

}

void Rec_Dec_To_Bin (int num)
{

if (((num / 2) != 0) && (num > 1))
{
Rec_Dec_To_Bin ((num / 2));
}

printf ("%d", (num % 2));

}

Is This Answer Correct ?    21 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you convert strings to numbers in C?

1177


What is a volatile keyword in c?

1122


What does calloc stand for?

1097


1) write a program to generate 1st n fibonacci prime numbers using Nested if 2) write a program to generate twin prime numbers from m to n using nested if 3) write a program to check whether a given integer is a strong number or not using nested if 4) Write a program to generate prime factors of a given integer using nested if 5)write a program to generate prime numbers from m to n using nested if 6)write a program to generate perfect numbers from m to n using nested if 7)write a program to generate the pallindromes from m to n using neste if 8)write a program to generate armstrong numbers from m to n using nested if 9)write a program to generate strong numbers from m to n using nested if

4554


what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above

1088


Is file a keyword in c?

890


What is floating point constants?

1089


I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.

2169


write a program to display all prime numbers

1920


What is meant by 'bit masking'?

1341


What does main () mean in c?

1063


Why we use void main in c?

1112


Explain what is the difference between text files and binary files?

1107


What is ## preprocessor operator in c?

1033


typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none

1167