how to add numbers with out using any arthematic operators in c
pavankumar77
0
Newbie Poster
Recommended Answers
Jump to PostNot a good way :( but it works fine.
int sum(int num1, int num2) { int total, temp, temptotal; total = num1 ^ num2; for(temp = num1 & num2; temp != 0; temp = temptotal & temp) { temptotal = total; total = total ^ (temp = …
Jump to PostYou wouldn't say that if you were lost in the Sahara Mountains! :icon_mrgreen:
Lost and chasing a camel. Not good odds for surviving.
More off topic than previously:
If you plan to get lost, rope can be obtain readily available
Jump to Postgerard4143, you're still using operator (-)
Jump to Postgerard4143, you're still using operator (-)
Whoops...busted
and the ++ operator in the for statement
Jump to Post@Gourav_4: That looks like Javascript, not C. You are using the minus (arithmetic) operator, so the answer is invalid.
All 20 Replies
DangerDev
107
Posting Pro in Training
Aia
1,977
Nearly a Posting Maven
Dave Sinkula
2,398
long time no c
Team Colleague
invisal
381
Search and Destroy
gerard4143
commented:
awesome code
+1
Narue
5,707
Bad Cop
Team Colleague
invisal
381
Search and Destroy
Aia
1,977
Nearly a Posting Maven
Dave Sinkula
2,398
long time no c
Team Colleague
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Aia
1,977
Nearly a Posting Maven
Narue
5,707
Bad Cop
Team Colleague
Aia
1,977
Nearly a Posting Maven
Dave Sinkula
2,398
long time no c
Team Colleague
gerard4143
371
Nearly a Posting Maven
joshSCH
commented:
Pay attention.
-2
Aia
1,977
Nearly a Posting Maven
invisal
381
Search and Destroy
gerard4143
371
Nearly a Posting Maven
Anuj Verma
0
Newbie Poster
Gourav_4
0
Newbie Poster
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.