Write a program that reads two numbers. Print the result of dividing the first by the second. Use only the addition and subtraction operators to calculate the result. Remember that the quotient of dividing two numbers is the number of times we can subtract the divisor from the dividend. For example, 20 ÷ 4 = 5
since we can subtract 4 five times from 20.
Answer:
##############################################################################
# Python From Scratch
# Author: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2025 - LogiKraft 2025
# Site: https://pythonfromscratch.com
# ISBN: 978-85-7522-949-1 (Paperback), 978-85-7522-950-7 (hardcover), 978-85-7522-951-4 (ebook)
#
# File: chapter 05/exercise-05-09.py.py
##############################################################################
dividend = int(input("Dividend: "))
divisor = int(input("Divisor: "))
quotient = 0
x = dividend
while x >= divisor:
x = x - divisor
quotient = quotient + 1
remainder = x
print(f"{dividend} / {divisor} = {quotient} (quotient) {remainder} (remainder)")