Skip to content

Commit fe462e7

Browse files
committed
Calculator program is also added in this algorithm file
1 parent 6c5bbed commit fe462e7

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

algorithms/calculator.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import math
2+
3+
def add(a,b):
4+
return(a+b)
5+
6+
def sub(c,d):
7+
return(c-d)
8+
9+
def mult(a,b):
10+
return(a*b)
11+
12+
def div(c,d):
13+
return(c/d)
14+
15+
16+
if __name__=='__main__':
17+
18+
k1=int(input("Enter 1st Number:"))
19+
k2=int(input("Enter 2nd Number:"))
20+
print("ADD: " +str(add(k1,k2)))
21+
print("SUB: " +str(sub(k1,k2)))
22+
print("MULT: " +str(mult(k1,k2)))
23+
print("DIV: " +str(div(k1,k2)))
24+

0 commit comments

Comments
 (0)