Select Page

## Decimal To Binary In C

Let’s understand the idea involved in the programming of “Binary To Decimal Conversion In C“. C program to convert an integer from decimal number system (base-10) to binary number system (base-2). The size of an integer is assumed to be 32 bits. We will use the bitwise operator “AND” to perform the desired task. We right shift the original number by 31, 30, 29, …, 1, 0 bits using a for loop and bitwise AND the number obtained with 1(one), if the result is 1, then that bit is 1 otherwise it is 0 (zero).

In Simple way, Store the remainder when the number is divided by 2 in an array. Divide the number by 2. Repeat the above two steps until the number is greater than zero. Print the array in reverse order now.

## Explanation Of Code:

• Step 1: 19/2, Remainder = 1, Quotient = 9
• Step 2: 9/2, Remainder = 1, Quotient = 4
• Step 3: 4/2, Remainder = 0, Quotient = 2
• Step 4: 2/2, Remainder = 0, Quotient = 1
• Step 5: 1/2, Remainder = 1, Quotient = 0

## Top Book Suggestion

The two books on C Programming Language that I Personally Recommend. I really loved reading these books. These books are listed for quality content, easy steps, and affordable price. You can get it from Amazon and Flipkart.

### Check The Price On Amazon:

1. C Programming Beginner’s Guide

### Check The Price On Flipkart:

1. Introduction to C Programming

2. Head First C: A Brain-Friendly Guide

### Buy Premium Courses At Lowest Price. Become A Certified Developer Today!

#### Important C Programs ...

## C Tutorial

... ...