how to convert binary to decimal and decimal to binary in C
lanaguage
Answer Posted / rahul
[decimal to binary]
#include<stdio.h>
#include<conio.h>
void main()
{
int dec,bin,a[100],i=0,r,j;
printf("enter the decimal number: ");
scanf("%d",&dec);
while(dec>0)
{
r=dec%2;
dec=dec/2;
a[i]=r;
i++;
}
printf("the equivalant binary numberis: ");
for(j=i-1;j>=0;j--)
printf("%d",a[j]);
getch()
}
| Is This Answer Correct ? | 72 Yes | 32 No |
Post New Answer View All Answers
How can you access memory located at a certain address?
code for find determinent of amatrix
What is main () in c?
What is the use of ?
Who is the founder of c language?
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
What is difference between static and global variable in c?
How do we open a binary file in Read/Write mode in C?
i want to know the procedure of qualcomm for getting a job through offcampus
When would you use a pointer to a function?
How can you draw circles in C?
Explain how can you be sure that a program follows the ansi c standard?
What is NULL pointer?
What is unary operator?
What are formal parameters?