Question:
How I can add two numbers in c language without using Arithmetic operators? `
Answer:
Sum = a xor b; carry = a and b; Source: CoolInterview.com
Answered by: srinivas ch | Date: 1/15/2009
| Contact srinivas ch
// suppose a=5 ;b=6 a=a+b; //a=11 b=a-b; //b=5; a=a-b; //a=6; Source: CoolInterview.com
Answered by: BIKRAM | Date: 1/19/2009
| Contact BIKRAM
#include<stdio.h> #include<math.h> int main() { int a,b,c; printf("enter the nos"); scanf("%d %d",&b,&c); a= (b^c); printf("%d",a); return 0; } Source: CoolInterview.com
Answered by: venkat | Date: 1/21/2009
| Contact venkat
#include<stdio.h> #include<conio.h> void main() { int a=8,b=3,i; clrscr(); while(b>0) { a++; b--; } printf("%d",a);
} Source: CoolInterview.com
Answered by: radhianand | Date: 6/11/2010
| Contact radhianand
i agree with this website Source: CoolInterview.com
Answered by: Jitendra Soni | Date: 9/1/2010
| Contact Jitendra Soni
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|