C program for converting decimal to binary number

Problem statement

Write a program to convert decimal number to binary number.
We can convert any decimal number (base-10 (0 to 9)) into binary number(base-2 (0 or 1)).

What is binary number and decimal number?

A binary number is consist of only 0’s and 1’s.
We can represent any number into the binary form.
Each digit is referred to as a bit.

Numbers from 2 to 9 are called as decimal numbers.
For example:

Decimal number Binary number
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001

In this way, we can convert any number into the binary number.

Program for converting decimal to binary.

Output:

Help others by sharing the content!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.