GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Programming  >  C

 Print  |  
Question:  Sum of two numbers without using arithmetic operators

Answer: ex:
int a=10;
int b=10;
int sum=a+b;
without using "+" operator calculate sum


August 08, 2008 13:18:18 #5
 Saurabh Sharma   Member Since: August 2008    Total Comments: 1 

RE: sum of two numbers without using arithmetic operators
 
Use minus operator :-
int a=10,b=20,c;
c=a-(-b);

     

 

Back To Question