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

#include<stdio.h>
int bin(int);
main()
{ int n,r;
printf("Enter the number in decimal:");
scanf("%d",&n);
r=bin(n);
printf("The binary equivalent is:%d",r);
getch();
}
int bin(int x)
{ int k;
if(x==0)
return 0;
k=x%2;
int j=k+(10*bin(x/2));
return j;
}

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the condition that is applied with ?: Operator?

1182


Tell me when would you use a pointer to a function?

1121


Can you please explain the difference between malloc() and calloc() function?

1181


Why is sizeof () an operator and not a function?

1089


What is boolean in c?

1150


What is difference between scanf and gets?

1371


hi send me sample aptitude papers of cts?

2220


Can we initialize extern variable in c?

1183


What do you mean by dynamic memory allocation in c?

1148


A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles

1231


What is the c language function prototype?

1140


Why is c so important?

1100


Why double pointer is used in c?

1088


about c language

2074


What are different types of pointers?

1105