Tuesday, 22 July 2014

How To Find Sum Of Two Numbers Without Any operator

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();
      }

2 comments: