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
What is a char c?
What are qualifiers and modifiers c?
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?
What is an arrays?
Is python a c language?
What is 2 d array in c?
write a program to concatenation the string using switch case?
Explain the difference between null pointer and void pointer.
What should malloc() do?
What is property type c?
What is context in c?
How can I read a binary data file properly?
Explain what is the concatenation operator?
What is p in text message?
What is getch() function?