how to write a prog in c to convert decimal number into
binary by using recursen function,



how to write a prog in c to convert decimal number into binary by using recursen function,..

Answer / madhavi

void decitobin(int n);

main()
{
int n;
printf("Enter an integer:");
scanf("%d",&n);
decitobin(n);
}

void decitobin(int n)
{
if(n>0)
{
decitobin(n/2);
printf("%d",n%2);
}
}

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C Interview Questions

Program to write some contents into a file using file operations with proper error messages.

2 Answers  


write an algorithm and a program to count the number of elements in a circularly singly linked list

1 Answers   Ignou,


Why we use void main in c?

0 Answers  


what is meant by c

9 Answers   INiTS,


What is the difference between a function and a method in c?

0 Answers  






What does & mean in scanf?

0 Answers  


how to make program without <> in libray.

0 Answers  


What are operators in c?

0 Answers  


write a c program for print your name .but,your name may be small letter mean print a capital letter or your name may be capital letter mean print a small letter .example \\enter ur name : sankar The name is: SANKAR (or) enter your name:SAnkar The name is:saNKAR

5 Answers  


Why data types in all programming languages have some range? Why ritche have disigned first time likethat?Why not a single data type can support all other types?

2 Answers   Excel,


What is the difference between the local variable and global variable in c?

0 Answers  


what is ram?

3 Answers   TCS,


Categories