forked from prasun420/Sorting-Python
-
Notifications
You must be signed in to change notification settings - Fork 9
/
calc.py
32 lines (30 loc) · 986 Bytes
/
calc.py
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
opt = int(input("enter the option you want to perform : 1.addition 2.multiplication"))
if opt==1:
s=0
n=int(input("enter how many times you want to sum up :"))
print("enter",n,"numbers : ")
for i in range(0,n):
a=int(input("enter the number"))
s=s+a
print("the result is : ",s)
elif opt==2:
m=1
n1=int(input("how many times you want to multiply : "))
print("enter",n1,"numbers :")
for i in range(0,n1):
b=int(input("enter the number :"))
m=m*b
print("the result is :",m)
elif opt==3:
n2=int(input("how many times you want to substract :"))
print("enter", n2 ,"numbers: ")
a=int(input("enter the 1st number"))
b=int(input("enter the 2nd number"))
#c=(a-b)
d=(n2-2)
print("you have to enter ", d, "numbers more")
for i in range(0,d):
c=(a-b)
e=int(input("enter the number : "))
f=c-e
print("the result is :", f)