Microsoft interview question

Add two integer together and return a integer without using any arithmetic operators

Interview Answers

Anonymous

Jul 27, 2014

simply use an iterator. int add(int a, int b) { for (int i = 0; i

3

Anonymous

Jan 6, 2014

Either using binary operation or loop: #include #include int add(int,int); void main() { int a,b; clrscr(); printf("Enter the two Numbers: "); scanf("%d%d",&a,&b); printf("Addition of two num. is : %d",add(a,b)); getch(); } //----------------------------------------------- int add(int a, int b) { if (!a) return b; else return add((a & b) #include void main() { int a=10,b=5,i; clrscr(); while(b>0) { a++; b--; } printf("%d",a); getch(); }

1

Anonymous

Jan 5, 2014

i don't understand

Anonymous

Jan 5, 2014

'integer' & 'integer' ...??