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.
Use the following BibTeX entry to cite this work:
@INPROCEEDINGS{DVMB2023, author={Doorn, Niels and Vos, Tanja and MarĂn, Beatriz and Barendsen, Erik}, booktitle={2023 IEEE Conference on Software Testing, Verification and Validation (ICST)}, title={Set the right example when teaching programming: Test Informed Learning with Examples (TILE)}, year={2023}, volume={}, number={}, pages={269-280}, doi={10.1109/ICST57152.2023.00033} }
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