-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFloorDivision.py
More file actions
88 lines (80 loc) · 1.71 KB
/
FloorDivision.py
File metadata and controls
88 lines (80 loc) · 1.71 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
A=14
B=40
print(""" IF input is A=14 and B=40 then,
modolous // and remainder % is
// Floor division - division that results into whole number adjusted
to the left in the number line x // y
""")
print("print(A/B) = " , A/B)
print("print(A//B) = " , A//B)
print("print(A%B) = " , (A%B))
print('''A=-14
B=40
''')
A=-14
B=40
print("print(A/B) = " , A/B)
print("print(A//B) = " , A//B)
print("print(A%B) = " , (A%B))
print('''
A=14
B=-40
''')
A=14
B=-40
print("print(A/B) = " , A/B)
print("print(A//B) = " , A//B)
print("print(A%B) = " , (A%B))
print('''
A=-14
B=-40
''')
A=-14
B=-40
print("print(A/B) = " , A/B)
print("print(A//B) = " , A//B)
print("print(A%B) = " , (A%B))
print('''
% Modulus - remainder of the division of left operand by the right
x % y (remainder of x/y)
// Floor division - division that results into whole number adjusted
to the left in the number line x // y
''')
print(("print(-12//12) =") + str(-12//12))
print(("print(12%11) =") + str(12%11))
print(("print(-12%11) =") + str(-12%11))
print(12%11)
print(-12%11)
print('''
from math import *
a=-6
b=4
print("floor(a/b) = ", floor(a/b))
print(-6//4)
print(-6%4)
print(a - b * floor(a/b))
a=24
b=7
print(divmod(a, b))
print(a/ b)
print(a// b)
print(a% b)
''')
from math import *
a=-6
b=4
print("floor(a/b) = ", floor(a/b))
print("-6//4 = " , -6//4)
print("-6%4 = " , -6%4)
print("(a - b * floor(a/b)) = " , a - b * floor(a/b))
a=24
b=7
print(" divmod(a, b)= " ,divmod(a, b))
print(a/ b)
print(a// b)
print(a% b)
print('''
''')
print(("10**3")+ "=" + str(10**3))
print((" Quotient of " ) + ( " 10//3 ")+ " = " + str(10//3))
print((" Remainder of " ) + ( " 10%3 " )+ " = " + str(10%3))