decimal to binary
in algebra, if the numeric and factorial part is separated by a dot (point) and base-10 number i.e. from 0-9 is called decimal number.
In mathematics, the binary number can be express in the base-2 number system that is 0,1.
Flowchart
program
#include <stdio.h>
#include <conio.h>
void main()
{
int no, var, re, bin = 0, i = 1;
printf("enter a number: ");
scanf("%d", &no);
var = no;
while (no != 0)
{
re = no % 2;
no = no / 2;
bin = bin + (re * i);
i = i * 10;
}
printf("%d binary value is %d ", var, bin);
getch();
}
OUTPUT
Enter a number 13
13 binary value is 1101
0 Comments