Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Somma interi non divisibili 7

# Somma gli interi da 1 al numero dato in input escludendo
# quelli divisibili per 7
# Richiede in input un numero maggiore di 100

inputValue = "0"
sum = 0
while int(inputValue) < 100:
    inputValue = input("\nInserire un numero maggiore di 100: ")
for i in range(1, int(inputValue)):
    if i%7 != 0:
        sum = sum + i
print ("\nLa somma dei numeri non divisibili per 7 è:", sum)

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.