119k views
2 votes
// Exercise 4.16: Mystery.java

2 public class Mystery
3 {
4 public static void main(String[] args)
5 {
6 int x = 1;
7 int total = 0;
8
9 while (x <= 10)
10 {
11 int y = x * x;
12 System.out.println(y);
13 total += y;
14 ++x;
15 }
16
17 System.out.printf("Total is %d%n", total);
18 }
19 } // end class Mystery

1 Answer

7 votes

Answer:

385

Step-by-step explanation:

There was no question so I simply run the program for you and included the output.

The program seems to calculate:
\sum\limits_(x=1)^(10) x^2

// Exercise 4.16: Mystery.java 2 public class Mystery 3 { 4 public static void main-example-1
User Richard Peers
by
4.9k points