how to get quotient value modulo equation in python code example
Example 1: Write a program to take input Dividend and Divisor and print its Quotient and Reminder in python
print("This is a simple calculator program which only divides.")
did = int(input("Pls enter the value of your divided in numbers:"))
dir = int(input("Pls enter the value of your divisor in numbers:"))
a = did / dir
b = did // dir
c = did % dir
print("Float value of quotient:", a, "\nInteger value of quotient:", b, "\nRemainder value:", c)
Example 2: Write a program to take input Dividend and Divisor and print its Quotient and Reminder in python
print("This is a simple calculator program which only divides.")
did = int(input("Pls enter the value of your divided in numbers:"))
dir = int(input("Pls enter the value of your divisor in numbers:"))
print("pls enter what you want to get from this calculator")
print("Warning: \nonly enter the option i.e. either a or b in lower case")
opt = input("a. Quotient \nb. Reminder \n")
if opt == "b" or opt == "b.":
ans = did % dir
print("Your answer \nRemainder is", ans)
elif opt == "a" or opt == "a.":
sol = did/dir
e = type(sol)
if e == float:
print("In which type of value do you want your answer")
print("Warning: \nonly enter the option i.e. either a or b in lower case")
o = input("a. Decimal \nb. Integer \n")
if o == "b" or o == "b.":
s = int(sol)
print("Quotient \nyour answer is ", s)
elif o == "a" or o == "a.":
f = float(sol)
print("Quotient \nYour answer is", f)
else:
print("The inputs are invalid")
exit()
elif e == int:
g = int(sol)
print("your answer \nQuotient is", g)
else:
print("The inputs are invalid")
exit()
else:
print("The inputs are invalid")
exit()