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

What is the difference between pure virtual function and virtual function?

1117


main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }

1546


What is substring in c?

1202


Why header file is used in c?

1089


How many levels of pointers can you have?

1188


What is the total generic pointer type?

1154


I have seen function declarations that look like this

1040


How do you sort filenames in a directory?

1167


What is chain pointer in c?

1058


Which node is more powerful and can handle local information processing or graphics processing?

1315


What header files do I need in order to define the standard library functions I use?

1053


What are the types of arrays in c?

1174


What are the 4 types of programming language?

1123


Is c dynamically typed?

1151


What is pointer to pointer in c language?

1139