What’s wrong here?? Please help. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
16th Apr 2021, 3:15 PM
Muhammad Rakib
Muhammad Rakib - avatar
3 Answers
+ 1
Just add a 'Sum=0;' after the third loop inside to reset the value of Sum to 0 for next multiplication. https://code.sololearn.com/c4GNgwQ4z13M/?ref=app
16th Apr 2021, 3:44 PM
noteve
noteve - avatar
+ 1
So many thanks Eve. But i don’t understand this. Initially I declare Sum =0 therefore the result would Come but it’s false or incorrect. Please explain the reason behind this. Thanks in advance ❤️❤️
16th Apr 2021, 3:50 PM
Muhammad Rakib
Muhammad Rakib - avatar
0
Muhammad Rakib I think that is because on line 12 and line 13 (the inner for loop), the value of Sum changes. That is why I thought of resetting the value of Sum to 0 after that particular for loop that changes the value of Sum.
21st Apr 2021, 12:47 AM
noteve
noteve - avatar