please check this script
//program to add to 8 bit binory numbers(2)
#include<iostream>
using namespace std;
int binory(int ,int *p);
int addbinory(int *,int *, int *);
//this is c++ program so if u want convert it c just change your cout to printf and cin to scanf and do nessassory changes
//this is a function to convert decimal to binary equavalent
int binory(int num, int *p)
{
int i=7;
cout<<"the number is : "<<num<<"\n";
while(num!=0)
{
int val=num%2;
cout<<"the remender is : "<<val<<"\n";
num=num/2;
p[i]=val;
i--;
cout<<"the p[i] value is : "<<p[i]<<"\n";
}
cout<<"\n the array values \n";
for(int k=0;k<8;k++)
{
//cout<<"\n the array values \n";
cout<<p[k]<<" ";
}
}
//This block will add two converted binory numbers
int addbinory(int *p,int *q,int *l)
{
int cf=0,i;
for(i=7;i>=0;i--)
{
l[i]=p[i]+q[i]+cf;
cf=0;
if(l[i]==2)
{
l[i]=0;
cf=1;
}
if(l[i]==3)
{
l[i]=1;
cf=1;
}
}
l[i]=cf;
cout<<"\n\n AFTER ADDING TWO BINORY NUMBERS IS \n\n";
for(i=0;i<8;i++)
{
cout<<l[i]<<" ";
}
cout<<"\n COmpleted\n";
}
int main()
{
int num,a[]={0,0,0,0,0,0,0,0},b[]={0,0,0,0,0,0,0,0},c[]={0,0,0,0,0,0,0,0};
cout<<"\nentre the number\n";
cin>>num;
binory(num,&a[0]);
cout<<"\nEnter second number\n";
cin>>num;
binory(num,&b[0]);
addbinory(&a[0],&b[0],&c[0]);
return 0;
}