This Program will add two numbers without using any binary arithmetic operator in c programming language..
#include<stdio.h>
#include<conio.h>
main()
{
int a,b;
printf("\n\tEnter 1st Value:==");
scanf("%d",&a);
printf("\n\tEnter 2nd Value:==");
scanf("%d",&b);
if(b>=0)
{
while(b>0)
{
a++;
b--;
}
}
else
{
while(b<0)
{
a--;
b++;
}
}
printf("\n\tThe Addition :==%d",a);
getch();
}
#include<stdio.h>
#include<conio.h>
main()
{
int a,b;
printf("\n\tEnter 1st Value:==");
scanf("%d",&a);
printf("\n\tEnter 2nd Value:==");
scanf("%d",&b);
if(b>=0)
{
while(b>0)
{
a++;
b--;
}
}
else
{
while(b<0)
{
a--;
b++;
}
}
printf("\n\tThe Addition :==%d",a);
getch();
}
Nice coding..Its working.amazing
ReplyDeleteplxxxx explain the programm
ReplyDelete