Invite a FriendSearchFAQRegisterLogin

Addition without '+' operator

Give some interview question on C Bit operations.

Addition without '+' operator

by game_iiith on Sun Jan 24, 2010 5:20 am

Write a function which takes 2 ints and returns their sum, without using the '+' operator.

Avi
Avi
A vast collection of programming problems @ http://avidullu.wordpress.com/
User avatar
game_iiith
Super Cracker
Super Cracker
 
Posts: 111
Joined: Sun Sep 06, 2009 1:26 pm

Re: Addition without '+' operator

by jalajb2k7 on Mon Jun 28, 2010 3:52 am

let the two numbers be a and b
printf("%d",printf("%*s,%*s,a," ",b," "));
jalajb2k7
Active Member
 
Posts: 9
Joined: Mon Jun 21, 2010 4:30 pm

Re: Addition without '+' operator

by alok.ahuja on Mon Jul 05, 2010 7:09 pm

Could you explain the logic behind it.
User avatar
alok.ahuja
Cool Cracker
Cool Cracker
 
Posts: 54
Joined: Wed Nov 14, 2007 8:24 pm


Return to C - Bit Fiddling

Who is online

Users browsing this forum: No registered users and 1 guest

cron