VOOZH about

URL: https://www.geeksforgeeks.org/c/c-decimal-to-binary/

⇱ Convert Decimal to Binary in C - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Convert Decimal to Binary in C

Last Updated : 23 Jul, 2025

In this article, we will learn to write a C program to convert a decimal number into a binary number. The decimal number system uses ten digits from 0 to 9 to represent numbers and the binary number system is a base-2 number system that uses only 0 and 1 to represent numbers.

👁 decimal to binary conversion in c

Algorithm to Convert Decimal Numbers to Binary in C

  • Find the remainder by taking the modulus of the given number with 2.
  • Store the remainder as a binary digit in an array.
  • Update the number by dividing it by 2.
  • Repeat these steps till the number is greater than zero.

C Program to Convert Decimal Numbers to Binary


Output
10001

Complexity Analysis

  • Time complexity: O(1)
  • Auxiliary space: O(1)

Please refer complete article on Program for Decimal to Binary Conversion for more details!

Comment
Article Tags:
Article Tags: