0

Multiples question....what did i do wrong

https://code.sololearn.com/cE3SM26aZtNv/?ref=app

21st Jun 2022, 2:22 PM
Aisy Danish Mohd Nazry
Aisy Danish Mohd Nazry - avatar
8 Answers
+ 1
You should be using the modulo operator to see what are multiples. Right now, your if statement is just looking at what number divided by 3 or 5 equals 0. But the only answer to the question mathematically is 0. So you need to rethink your logic in finding what numbers have a REMAINDER of 0 when decided by 3 or 5. So you're close, just have your operators a bit off.
21st Jun 2022, 2:33 PM
Justice
Justice - avatar
+ 1
Thank you very much .... :)
21st Jun 2022, 2:34 PM
Aisy Danish Mohd Nazry
Aisy Danish Mohd Nazry - avatar
0
Can you please elaborate on what you are trying to do? You don't have any comments and your code has very generic variable names.
21st Jun 2022, 2:24 PM
Justice
Justice - avatar
0
Multiples community question
21st Jun 2022, 2:24 PM
Aisy Danish Mohd Nazry
Aisy Danish Mohd Nazry - avatar
0
I don't know what community question you are referring to and you don't have the reference in the comments of your code either. Don't assume everyone will know what you are talking about so make sure to always leave references, or at least make your code readable to outside readers.
21st Jun 2022, 2:27 PM
Justice
Justice - avatar
0
You need to calculate the sum of all the multiples of 3 or 5 below a given number. Task: Given an integer number, output the sum of all the multiples of 3 and 5 below that number. If a number is a multiple of both, 3 and 5, it should appear in the sum only once. Input Format: An integer. Output Format: An integer, representing the sum of all the multiples of 3 and 5 below the given input. Sample Input: 10 Sample Output: 23
21st Jun 2022, 2:28 PM
Aisy Danish Mohd Nazry
Aisy Danish Mohd Nazry - avatar
0
Sorry
21st Jun 2022, 2:29 PM
Aisy Danish Mohd Nazry
Aisy Danish Mohd Nazry - avatar
0
No problem. đŸ‘đŸŸ
21st Jun 2022, 2:35 PM
Justice
Justice - avatar