Write a program to take input Dividend and Divisor and print its Quotient and Reminder in python
# Write a program to take input Dividend and Divisor and print its Quotient and Reminder
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()
4
1
# Write a program to take input Dividend and Divisor and print its Quotient and Reminder
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)
Thank you!
1
0
Are there any code examples left?
New code examples in category Python
-
Python 2023-04-11 03:04:20
-
Python 2022-03-27 22:40:04 pycharm no module named
-
Python 2022-03-27 22:25:05 assign multiple variablesin one line
-
Python 2022-03-27 22:20:02 levenshtein distance
-
Python 2022-03-27 21:35:09 get text from url python last slash
-
Python 2022-03-27 21:30:30 df concatenate df
-
Python 2022-03-27 21:25:09 python odd or even
-
Python 2022-03-27 21:15:32 python include function from another file
-
Python 2022-03-27 21:10:01 color module python
-
Python 2022-03-27 21:00:27 python tkinter cursor types