for (int year = 1; year <= 10; year++){
amount = principal * Math.pow(1+rate, year);
principal = amount;
System.out.printf("%d%20.2f\n",year,amount);
for (int year = 1; year <= 10; year++){
amount = principal * Math.pow(1+rate, year);
System.out.printf("%d%20.2f\n",year,amount);
// what is the difference between these two?
GeekTool
0
Junior Poster in Training
Recommended Answers
Jump to PostCan you post the output from the code?
One problem I see is there is no ending }s for the two {s
Jump to PostThat will depend on the initial value of Principal and the rest of the code.
All 5 Replies
NormR1
563
Posting Sage
Team Colleague
thines01
401
Postaholic
Team Colleague
Featured Poster
GeekTool
0
Junior Poster in Training
TrustyTony
888
pyMod
Team Colleague
Featured Poster
prnjn
0
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.