Write a code to get two positive values from user and multiply them just by sum and sub!!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Write a code to get two positive values from user and multiply them just by sum and sub!!!

this one is not a Q it's a challenge😄

23rd Mar 2017, 9:37 PM
TahaNM
TahaNM - avatar
7 Answers
+ 13
As your question is stated, the values are supposed to be taken from user. If the input variables are x and y, then just keep adding x with 0 y times!
23rd Mar 2017, 9:55 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 12
Well suppose you need to calculate 3*4 keep adding 3 with 0 four times 0+3+3+3+3 use loop to solve this problem
23rd Mar 2017, 9:42 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 4
Should the 2 values be integers?
24th Mar 2017, 1:19 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
0
we don't know what are these valuse😄
23rd Mar 2017, 9:50 PM
TahaNM
TahaNM - avatar
0
you have to get those put those valuse in a loop,then in every loop decrease one of the valuse one number and sum another one with itself until the first one reach to 0like this: cin>>n cin>>m for(int m,m>0,m--;) {n=n+n}
23rd Mar 2017, 9:57 PM
TahaNM
TahaNM - avatar
0
I've done it; n Python. Check my profile to see the code (if you find it between all my hundreds of other codes)
23rd Mar 2017, 10:50 PM
Karlo
Karlo - avatar
0
yes they should be integers
24th Mar 2017, 3:52 AM
TahaNM
TahaNM - avatar