Learn basic concept of c , c++ and python programming in regularcodes.com

Spread the post

Program for Decimal to Binary Conversion

Various method are use to convert decimal to binary number.

1) Using recursion

2) Using array

3) Using bitwise operator

Method 1 :Using recursion


This function get one decimal value and get the result of binary number.

C program to convert decimal to binary using recursion.

Output


This program work on only positive decimal value.

View code execution

Stack Areamainnumber (int) =17binarynumber (int) =17recursionvalue (int) =17recursionvalue (int) =8recursionvalue (int) =4recursionvalue (int) =2

Not given all execution process

Try it Yourself

Method 2: Using array


c program to convert decimal to binary with using array.

Output

View code execution process.

View solution

Method 3: Using bitwise operator.


c program to convert decimal to binary using bitwise operators


Output

View code execution process.

View Execution

Spread the post

Recommended Posts: