PY
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
#divide and multiply two numbers
# without using -, *, / operator
def red_by_one(x):
a=0
for _ in range(1,x):
a+=1
return a
def subtract(x,n):
for _ in range(n):
x=red_by_one(x)
return x
def quotient(x,y):
q=0
if(y!=0):
while(x>=y):
q+=1
x=subtract(x,y)
return q
else:
return -1
def multiply(x,y):
m=0
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run