Write a snippet of code (not a function) that prints the sum of all odd integers between start
and end
,
inclusive, Int
variables that have been declared and initialized already.
So you should start at start
and include all odd numbers up to and including end
.
You can test if a number is even by using the remainder operator: n % 2 == 0
.
Stuck? You may find these lessons helpful: