# Program to compute the sum of the first n numbers # Matt Bishop, Apr. 2, 2009 # for ECS 10 Spring 2009 def main(): # initialize variables total = 0; # read how high we are to count n = input("Please enter a number:"); # loop over the first n numbers, # adding them as we go for i in range(n+1): total = total + i; # print out the total print "The total of the first", n, "numbers is", total; main()