Couple more problems

This commit is contained in:
2016-02-05 21:54:01 -08:00
parent c80fb6f2a6
commit 73239e1c23
8 changed files with 229 additions and 0 deletions

17
problem_6.py Normal file
View File

@@ -0,0 +1,17 @@
#Difference between the sum of squares and the square of the sum of the first 100 numbers
#find the sum of the squares
sum_of_squares = 0;
for i in range (1, 101):
sum_of_squares += i * i
#find the square of the sum
square_of_sums = 0
for i in range(1, 101):
square_of_sums += i;
square_of_sums *= square_of_sums
#find the difference
square_of_sums -= sum_of_squares
print(square_of_sums)