I have a homework assignment that I have spent entirely to much time on. Read through the book, been trying to use google for help on tutorials, and have turned no luck. I know how to set the even numbers from the odd number with the mod, but have no idea on a appropriate way to just add the even numbers.
The program must be between the numbers 1 and 100 (already stated that properly I believe), then computes the sum of all even numbers within that parameter. The output of the sum must be after the loop.
Here is what I got so far:
int number = 1;
int sum = 0;
while (number >= 1 && number <= 100)
if (number % 2 == 0)
The program must be between the numbers 1 and 100 (already stated that properly I believe), then computes the sum of all even numbers within that parameter. The output of the sum must be after the loop.
Here is what I got so far:
int number = 1;
int sum = 0;
while (number >= 1 && number <= 100)
if (number % 2 == 0)