Program To Add Binary Number
Table of Contents
Hey learner, In this tutorial we are going to program for the sum of Binary Number in C, So if you want to learn then, follow the below code. So lets start the Add Binary Number Program.

In C programming, the Program to add Binary number is so easy, First of all take two binary number in integer, and then use one and one digit from right side by using mod operation. and add them if the sum of binary number is 10, then 1 should be reminder and take that reminder in the second digit sum. And so on.

Program in C
#include<stdio.h>
int main()
{
int sum[10], binary1,binary2;
int i=0, rem =0;
printf("Enter the first binary number : ");
scanf("%ld",&binary1);
printf("Enter the second binary number : ");
scanf("%ld",&binary2);
while(binary1!=0 || binary2!=0)
{
sum[i++] = (binary1%10 + binary2%10 + rem)%2;
rem = (binary1%10 + binary2%10)/2;
binary1 = binary1/10;
binary2 = binary2/10;
}
if(rem!=0)
sum[i++] = rem;
--i;
printf("The sum of binary Number is : ");
while(i>=0)
{
printf("%d",sum[i]);
i--;
}
printf("\n\n");
return 0;
}
Video Tutorial for adding Binary Number in C
Learn More Python Tutorials
- Sieve of Eratosthenes In Python
- Python string Methods
- List methods in Python
- python Sequence Tutorial
- Fibonacci Program in Python
- Python Sub-String
- Lower String in python
- Python Tkinter for GUI
- Install Python in your system
If you have any queries regarding Program Sum of Binary Number In C, then ask in the comment section, I am happy to answer your question. And If You got some benefits from this article then please share it with your friends.