Exercise 10: while Loops
Let's test your ability to write while loop.
We'll cover the following
Problem Statement
Run a loop from to and for each number, print foo if it is a multiple of , bar if it is a multiple of and foo bar if it’s a multiple of both and .
Use
cat()
for printing. Remember to print the number as well as the respective statement!
Sample Output
3 foo 5 bar 6 foo 9 foo 10 bar 12 foo 15 foo bar 18 foo 20 bar
Test Yourself
Write your code in the given area. If you get stuck, you can look at the solution.
# Write your code herecat(" ")