gravatar

T1047-asd

20171113834 at 2018-02-27T13:06:18+00:00 Go TO Problem T1047

<!--Markdown--> <!--Markdown--> import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); double y = in.nextDouble(); double n = 10000; double all = 0; int i = 1; for (i = 1; i <= y; i++) { n = Math.ceil((n * (1 + 0.05)) * 100) / 100; } System.out.printf("Tuition after " + (int) y + " year: %.2f", n); System.out.println(); for (i = 0; i < 4; i++) { all += n; n = Math.ceil((n * (1 + 0.05)) * 100.0) / 100.0; } System.out.printf("Tuition for 4 year: " + "%.2f", all); } }

Comments:

No comment yet.