Modify the previous program such that only multiples of three or five are considered in the sum, e.g.. 3,5,6,9,10,12,15 for n. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Modify the previous program such that only multiples of three or five are considered in the sum, e.g.. 3,5,6,9,10,12,15 for n.

2nd Dec 2021, 12:25 PM
Jana Rizalie Nipaya
2 Answers
+ 2
well you need a cycle to go through your numbers, and inside a cycle use if method and check if number%3==0 || number number%5==0
2nd Dec 2021, 12:37 PM
cadbrooke
cadbrooke - avatar
0
Please follow this guide on how we post a question. Also mind to use the tags properly https://www.sololearn.com/Discuss/333866/?ref=app https://code.sololearn.com/W3uiji9X28C1/?ref=app
2nd Dec 2021, 1:25 PM
Ipang