How to add two numbers without using the plus operator?
codergem
0
Newbie Poster
Recommended Answers
Jump to PostThere are many ways. You could do how you do it on paper. You could use the property x + y = (x-1)+(y+1).
Jump to PostHere is one idea using the post increment operator:
int a, b; cout << "\nEnter first number: "; cin >> a; cout << "\nEnter second number: "; cin >> b; for (int i = 0; i < a; i++) b++; cout << "\nThe answer is: " << …
All 6 Replies
Rashakil Fol
978
Super Senior Demiposter
Team Colleague
codergem
0
Newbie Poster
Clinton Portis
211
Practically a Posting Shark
codergem
0
Newbie Poster
Rashakil Fol
978
Super Senior Demiposter
Team Colleague
iamthwee
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.