How to convert decimal to binary in C using recursion??
Answer Posted / rajaas tahir
# include <stdio.h>
#include<conio.h>
void Bin (int num);
int main (void)
{
int num;
int base;
printf ("Enter the decimal number to convert it binary.\n");
scanf ("%d", &num);
printf ("The %d in binary is : ", num);
Bin (num);
getch();
}
void Bin (int num)
{
int a, b;
a=num/2;
if ((a!= 0) && (num > 1))
{
printf("%d",(num%2));
Bin (num / 2);
}
}
| Is This Answer Correct ? | 3 Yes | 14 No |
Post New Answer View All Answers
What is echo in c programming?
What is difference between structure and union?
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
Can one function call another?
Does c have an equivalent to pascals with statement?
a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above
What is the translation phases used in c language?
Suppose we have a table name EMP as below. We want to perform a operation in which, I want to change name ‘SMITH’ from as ‘SMITH JAIN’. Also I want to change the name of the column from ENAME to E_NAME. EMPNO ENAME JOB MGR HIREDATE SAL 7369 SMITH Coder 7902 17-DEC-80 800 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 7521 WARD SALESMAN 7698 22-FEB-81 1250
What is file in c language?
‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .
Can we change the value of constant variable in c?
Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent
What is static and auto variables in c?
how do you programme Carrier Sense Multiple Access
a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if