148k views
0 votes
Edhesive 2.3, Q1: 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.

My code: x = float(input("input an integer:"))

y = float(input("input an integer:"))

print (x / y)

print (x % y)

I've tried using ints, adding the extra slash for rounded quotient, but the system doesn't accept it. Please help

User Schenker
by
8.2k points

1 Answer

0 votes

Answer:

The program which you have written should work fine.

If you feel if there is a problem, first you can first clear all the cached memory using “ccleaner” or any other software, restart the system, and once again try to execute. If it is giving you an error especially in the below line,

print (x / y)

Some language consider “/” as extra or special character, so you can always use “escape sequence”.

For eg. x \/y might work out.

Alternatively you can try splitting the calculation and the printing part.

c = x / y

print c

User Xelibrion
by
7.8k points