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
Can we change the value of #define in c?
What is volatile keyword in c?
can any one tel me wt is the question pattern for NIC exam
how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions
What is the difference between functions abs() and fabs()?
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
What are dangling pointers in c?
What is a pointer variable in c language?
What do you mean by recursion in c?
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?
Explain how can you tell whether two strings are the same?
Describe the steps to insert data into a singly linked list.
If the size of int data type is two bytes, what is the range of signed int data type?
Explain what is #line used for?