193k views
5 votes
Write a program that prompts the user to input two numbers, a numerator and a divisor. Your program should then divide the numerator by the divisor, and display the quotient and remainder.

(this is python and i really need help. this is the code i have so far and it won’t accept it.)

User Robert Fey
by
4.7k points

1 Answer

4 votes

Answer:

#first section

a= float(input(" enter Numerator: " ))

b= float(input(" enter Divisor: "))

#second section

c = a//b

d = a%b

#third section

print(c, "is the quotient")

print(d, "is the remainder")

print ( c," remainder ",d)

Step-by-step explanation:

In python (programming language) there are other ways to divide other than using the normal division "/".

we have floor division "// " and % modulo

floor division "//" gives you just the QUOTIENT

modulo gives you the REMAINDER.

now the program is divided into 3 sessions to make it easy for you to understand.

The first session - This is the input session, it prompts you to in put two values respectively, one for the Numerator and one for the divisor.

The second session - this is where the calculation happens, we carry out a floor division first and then a modulo division.

The third session - This is the Output session prints your answer to the screen, firstly it tells you which number is the quotient and which number is the remainder, after that it combines both the quotient and the remainder into one output

User Wix
by
5.5k points