| preferred AP College board partner for AP classes
AP Computer Science A/Unit 4: Iteration
Start Practice Test
Share
easy Solved by 8 students
For Loop Accumulator Variable
< Prev
Next >

A savings plan simulation deposits an amount equal to twice the day number for 7 days. What total amount is printed at the end?

public class Savings {
    public static void main(String[] args) {
        int total = 0;
        for(int day = 1; day <= 7; day++) {
            total += day * 2;
        }
        System.out.println(total);
    }
}
A

54

B

56

C

28

D

49

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1hadleysmith522 0m 00s 200
#2sgarv251311 0m 00s 100
#3hitrishabhatia11 0m 00s 100
#4mertdeg14 0m 00s 70
#5y.seong202711 0m 44s 56
#6gtsak3111 2m 50s -70
#7suhanakochhar00611 9m 19s -459
APFIVE © 2020.
Email: [email protected]|Privacy Policy