Repository with assignments using the Test Informed Learning with Examples (TILE) method to integrate testing into existing programming courses for free.
Join our LinkedIN Community.
Write a program to calculate the quotient and remainder of the integer division of two positive integers, using only the subtraction operation.
Test your program with the following outputs:
>>> %Run
Enter a positive integer number: 0
Enter another positive integer number: 4
The quotient is 0
The reminder is 0
>>> %Run
Enter a positive integer number: 4
Enter another positive integer number: 0
It cannot be divided by 0
>>> %Run
Enter a positive integer number: 25
Enter another positive integer number: 25
The quotient is 1
The reminder is 0
>>> %Run
Enter a positive integer number: 26
Enter another positive integer number: 20
The quotient is 1
The reminder is 6
>>> %Run
Enter a positive integer number: 20
Enter another positive integer number: 26
The quotient is 0
The reminder is 20
>>> %Run
Enter a positive integer number: -4
Enter another positive integer number: 5
Only positive integers
>>> %Run
Enter a positive integer number: 10
Enter another positive integer number: -4
Only positive integers