Calculate and display the sum of all the numbers divisible by 7 between 18 and 534 using loops and conditional statements i.e. 21+28+35+...+525+532.
total=0
n=18
while n<534:
if not n%7:
total+=n
n+=1
print ('The sum of all the numbers divisible by 7 between 18 and 534 is {}.'.format(total))
Comments
Leave a comment