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 / 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


Please Help Members By Posting Answers For Below Questions

What are the 5 data types?

1208


What is the mean of function?

1190


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?

2245


Where is volatile variable stored?

1141


How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same

1168


What is the difference between typedef and #define?

1111


What is the right type to use for boolean values in c?

1085


What is the significance of c program algorithms?

1193


The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

1322


What is a void pointer in c?

1153


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)

2385


what do the 'c' and 'v' in argc and argv stand for?

1214


How will you declare an array of three function pointers where each function receives two ints and returns a float?

1426


What type is sizeof?

1082


Explain how to reverse singly link list.

1200