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 pass by value in c?

1022


What is the purpose of main( ) in c language?

1101


What is the best organizational structure?

1072


List the different types of c tokens?

1019


What is a structure and why it is used?

1146


Is null equal to 0 in sql?

1101


How can you access memory located at a certain address?

1067


we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?

1219


How does struct work in c?

1035


In a switch statement, what will happen if a break statement is omitted?

1022


What is scope of variable in c?

1003


pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)

2588


Explain modulus operator. What are the restrictions of a modulus operator?

974


What are control structures? What are the different types?

1047


Is boolean a datatype in c?

1020