Advertisement
atanasovetr

Vasi

Nov 30th, 2021
662
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. print("Input some integers to calculate their sum and average. \nInput 0 to exit")
  2. n = int(input())
  3. sum = 0
  4. count = 0
  5. while (n != 0):
  6.     sum += n
  7.     n = int(input())
  8.     count += 1
  9. average = sum / count
  10. print("Average: %.2f" % average)
  11. print("Sum: %.2f" % sum)
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement