Tuesday, July 30, 2019

Dividend by divisor

Script

#!/usr/local/bin/python3.7

print()
dividend = int(input("Please enter the number to be divided: "))
divisor = int(input("Please enter the number to perform the division: "))

print()
if divisor != 0:
    print(dividend, "/", divisor, " = ", dividend/divisor)
else:
    print("Division by zero is not allowed")
print()


Execution

Please enter the number to be divided: 37
Please enter the number to perform the division: 5

37 / 5  =  7.4


Please enter the number to be divided: 73
Please enter the number to perform the division: 3

73 / 3  =  24.333333333333332


Please enter the number to be divided: 97
Please enter the number to perform the division: 0

Division by zero is not allowed




No comments:

Post a Comment