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 pointer to pointer in c?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
Write a program to check prime number in c programming?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
What is a char in c?
What is pointer and structure in c?
Are global variables static in c?
Why cant I open a file by its explicit path?
how to find anagram without using string functions using only loops in c programming
how to introdu5ce my self in serco
What is array in c with example?
What are the loops in c?
Can a local variable be volatile in c?
void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }
What is the significance of scope resolution operator?