REPEAT program
Question E: REPEAT procedure
Total score for this question: 15 points
【Problem Description】
The attached prog.txt is a program written in a certain language.
Among them, REPEAT k represents a cycle of number k. The range of loop control is expressed by indentation,
From the next line, the continuous indentation more than this line (the previous blank is longer) is the content contained in the loop.
For example, the following fragment:
Insert picture description here
In this fragment, the line from A = A + 4 to the line A = A + 8 is in the first line of the loop twice.
REPEAT 6: The line where A = A + 7 is in the REPEAT 5: loop.
A = A + 5 The actual total number of cycles is 2 × 5 × 6 = 60 times.
After the program is executed, what is the value of A?
The answer is: 403
Problem-solving ideas: I feel like translating the above language
int A=0;
for(int i=0;i<2;i++) {
A=A+4;
for(int j=0;j<5;j++) {
for(int z=0;z<6;z++) {
A=A+5;
}
A=A+7;
}
A=A+8;
}
A=A+9;
System.out.println(A);