227k views
0 votes
In the box provided below, write a for loop that adds the numbers in this sequence: 10,12,14,16,18, and stores the total in an integer variable called sum. int sum = 0;

User Choo
by
7.0k points

1 Answer

3 votes
int sum=0;
for(int num=10; num<=18; num+=2) {
sum += num;
}
User Sean Woods
by
7.5k points