- Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpatternsum.py
More file actions
Latest commit
35 lines (35 loc) · 715 Bytes
/
Copy pathpatternsum.py
File metadata and controls
35 lines (35 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
defsumofs1():
s1=0
n=int(input("enter a number:"))
foriinrange(1,n+1):
s1=s1+i
print("sumofs1=",s1)
defsumofs2():
s2=0
m=int(input("enter a number:"))
forjinrange(1,m+1):
s2=s2+(j*j)
print("sumofs2=",s2)
defsumofs3():
s3=0
p=int(input("enter a number:"))
forkinrange(1,p+1):
s3=s3+(k*k*k)
print("sumofs3=",s3)
defsumofs4():
s4=0
q=int(input("enter a number:"))
forlinrange(1,q+1):
s4=s4+(l**l)
print("sumofs4=",s4)
defsumofs5():
s5=0
r=int(input("enter a number:"))
forainrange(1,r+1):
s5=s5+((a**a)**a)
print("sumofs5=",s5)
sumofs1()
sumofs2()
sumofs3()
sumofs4()
sumofs5()