15,947,958 members
1.00/5 (1 vote)
See more:
Soit N dans N.
Écrire une fonction donnant la somme des entiers de [1,N[ divisibles par 3 ou 5.

Translation:
Let N be in N.
Write a function giving the sum of the integers of [1,N[ divisible by 3 or 5.

Python
```N=eval(input("enter a number:"))
s=0
for i in range(1, N):
if i%3==0 and i%5==0 :
s=s+i
print(s)
else:```

What I have tried:

i dont know what to write in the else part
Posted
Updated 18-Dec-23 15:44pm
v3

## Solution 1

First, you don't have to specify an else if there's nothing to do outside of the conditions you've been given.

Next, the program spec says
Quote:
Write a function giving the sum of the integers of [1,N] divisible by 3 or 5.
You might want to look a little closer at your code to see if your code matches that condition.

CPallini 19-Dec-23 2:02am
5.

## Solution 2

Quote:
i dont know what to write in the else part
First, you have to fix your `if`condition. As suggested, look again at the requirement. See if your code complies.
The `else` part is optional, if you don't need it, then omit it.