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 ways to a null pointer can use in c programming language?

1135


What are the types of macro formats?

1113


What is getch?

1183


What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?

1049


What are the 5 organizational structures?

1024


Is exit(status) truly equivalent to returning the same status from main?

1068


Explain what are multibyte characters?

1183


How are strings stored in c?

1010


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

1132


Write a program to check whether a number is prime or not using c?

1054


Who invented bcpl language?

1194


What is 1d array in c?

1084


Explain what is the difference between functions abs() and fabs()?

1178


What is the difference between malloc() and calloc() function in c language?

1074


How pointer is different from array?

1072