Easy Peasy Loop
Geoffrey Challen // 2020.9.0
Assuming an Int
variable named count
has been declared and initialized to a value larger than or equal to 0,
write a snippet of code (not a function) that alternately prints "peasy" and "easy" on subsequent lines a total
of count
times. So if count
is 7, you should print:
peasy
easy
peasy
easy
peasy
easy
peasy
Note that you can test if a number is even by using the remainder operator: n % 2 == 0
.