How to write a program that prompts the user to input two POSITIVE numbers — a dividend (numerator) and a divisor (denominator). Your program should then divide the numerator by the denominator, and display the quotient followed by the remainder in python.

Respuesta :

Answer:

num1 = int(input("Numerator: "))

num2 = int(input("Denominator: "))

if num1 < 1 or num2<1:

     print("Input must be greater than 1")

else:

     print("Quotient: "+str(num1//num2))

     print("Remainder: "+str(num1%num2))

Explanation

The next two lines prompts the user for two numbers

num1 = int(input("Numerator: "))

num2 = int(input("Denominator: "))

The following if statement checks if one or both of the inputs is not positive

if num1 < 1 or num2<1:

     print("Input must be greater than 1")-> If yes, the print statement is executed

If otherwise, the quotient and remainder is printed

else:

     print("Quotient: "+str(num1//num2))

     print("Remainder: "+str(num1%num2))