def zum(n):
	i=1
	p=0
	while i<=n:
		p += i
		i += 1
	return p

def zumsq(n):
	i=1
	q=0
	while i<=n:
		j = i**2
		q += j
		i += 1
	return q


x = input('Compare sum squared and square sum up to? ')
x=int(x)

print('The sum squared up to and including ' + str(x) + ' is:') 

sqsum = zum(x) ** 2

print(sqsum)

print('The sum of the squares up to and including ' + str(x) + ' is:') 

sumsq = zumsq(x)
print(sumsq)

print('Hence the difference is:')

diff = sqsum - sumsq

print(diff)
