Answer to Question #243801 in Python for python

Question #243801

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.

Hint: If you use division (/) to calculate the quotient, you will need to use int() to remove the decimals. You can also use integer division (// ), which was introduced in Question 10 of Lesson Practice 2.3.

Once you've calculated the quotient, you will need to use modular division (%) to calculate the remainder. Remember to clearly define the data types for all inputs in your code. You may need to use float( ) , int( ), and str( ) in your solution.

.

1
Expert's answer
2021-09-29T01:16:26-0400
num = int(input("Enter Numerator "))
den = int(input("Enter Denominator "))
print("quotient is ",str(num//den)," remainder is ", str(num%den))

Sample input :

Enter Numerator10

Enter Denominator3

quotient is 3 remainder is 1


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS