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
'''
division without / with N and D are intgers
'''
def Div(N,D):
Q=0
R=0
neg=0
if N<0 and D<0:
neg=0
elif N<0 or D<0 :
neg=1
if D==0:
return "Division Error we Can\'t divide by zero "
else:
while True:
N=abs(N)
D=abs(D)
if N-D>=0:
N=N-D
Q+=1
else:
R=N
if neg==1 :
return -Q, 'the reminder is',R
break
else:
return Q, 'the reminder is' ,R
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run