Answer:
a. int x = 1, total = 0;
while (x <= 10){
total += x;
++x;
}
b. while (x <= 100){
total += x;
++x;
}
c. public class Mystery{
public static void main(String[] args){
int x = 1;
int total = 0;
while (x <= 10){
int y = x * x;
System.out.println(y);
total += y;
++x;
}
System.out.printf("Total is %d%n", total);
}
Step-by-step explanation:
For the first code, the variable "total" was not initialized, so to avoid raising an error message, an integer value must be assigned to it before the increment. Code block two of the second while statement must be enclosed in curly braces, while the third code must be indented properly.