Course of Raku / Essentials / Loops / Exercises

Division via subtraction

Problem

Create a program that implements integer division via subtraction. The program has hard-coded numbers:

my $a = 175;
my $b = 25;

Complete the program so that it prints the integer part of $a / $b. Use a loop and subtraction only.

Example

$ raku division-via-subtraction.raku
7

Solution

See the solution

Next exercise

💪 FizzBuzz in a loop

Course navigation

Conditional checks / Ternary operator   |   Data type conversion

Translations of this page: EnglishDeutschEspañolItalianoLatviešuNederlandsБългарскиРусскийУкраїнська