Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
medium Solved by 10 students

Java For Loop Code Tracing

< Prev
Next >

What is printed when the following code segment is executed?

double principal = 1000.0;
double rate = 0.05;
int years = 3;
double amount = principal;
for (int i = 0; i < years; i++) {
    amount = amount * (1 + rate);
}
System.out.println((int) amount);
A

1157

B

1200

C

1158

D

1150

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question
Mark for review

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1hitrishabhatia11 0m 00s 100
#2mertdeg11 0m 00s 100
#3sgarv251312 0m 00s 90
#4midnightasdark11 1m 11s 29
#5suhanakochhar00611 2m 15s -35
#6yuvansankarnyc11 2m 51s -71
#7gtsak3111 5m 01s -201
#8y.seong202702 4m 07s -267
#9kazvin.tjakradinata14 6m 19s -309
#10Pelisx11 30m 48s -1,748
Items per page:
10
1 – 10 of 10
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|FAQ