-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalculator.py
68 lines (49 loc) · 1.11 KB
/
Calculator.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
print('Input two double digit numbers by pressing enter')
x=input();
y=input();
product=int(x[1])*int(y[1])+10*(int(x[0])*int(y[1])+int(x[1])*int(y[0]))+int(x[0])*int(y[0])*100
add=int(x[1])+int(y[1])+10*(int(x[0])+int(y[0]))
sub=int(x[1])-int(y[1])+10*(int(x[0])-int(y[0]))
print('Product ', product)
print('Sum ',add)
print('Subtraction ',sub)
print('Input single digit number to divide first')
z=input()
ha=1;
j=0;
while ha:
r=int(x[1])+10*int(x[0])-j*int(z[0]);
if(r<int(z[0])):
ha=0;
j=j+1;
j=j-1;
ha=1;
h=0;
while ha:
r2=r*10-h*int(z[0]);
if(r2<int(z[0])):
ha=0;
h=h+1;
h=h-1;
print('division ',j,'.',h)
print('Input 3 digit number to find the square root')
sq=input();
ha=1;
a=0;
while ha:
luv=int(sq[0])*100+int(sq[1])*10+int(sq[2])-100*a*a;
a=a+1;
if luv<0:
ha=0;
a=a-2;
ha=1;
b=0;
while ha:
luv2=int(sq[0])*100+int(sq[1])*10+int(sq[2])-100*a*a-(20*a+b)*b;
b=b+1;
if luv2<0:
ha=0;
b=b-2;
print('root ',10*a+b)
def hsin(x):
return x