# print the first thousand integers, 1...1000, one per line, 
# and then print("All done")
#
def printFirstThousand():
    current = 1
    
    while (current <= 1000):

        print(current)

        current = current + 1
        
    print("All done")
    
# return sum of first thousand integers: 1...1000
#
def sumOfFirstThousand():
    result = 0
    current = 1
    while (current <= 1000):
        # in the body I have a value of current to use
        result = result + current
        
        current = current + 1
        
    return result

# return the sum of the first one thousand squares: 1, 4, 9, ...
#
def sumOfFirstThousandSquares():
    result = 0
    current = 1
    while (current <= 1000):
        
        currentSquared = current * current
        result = result + currentSquared
        #print(current, currentSquared, result)
        
        current = current + 1
        
    return result

# return the sum of first n integers: 1...n
#
def sumOfFirstN(n):
    result = 0
    current = 1
    while (current <= n):
        #print("current:", current)
        result = result + current
        
        current = current + 1
        
    return result

def sumOfFirstNv2(n):
    result = 0
    current = n
    while (current > 0):
        result = result + current
        
        current = current - 1
        
    return result


 
