📄 mistake1.java
字号:
/* Incorrect attempt to sum the squares of
* numbers from 1 to a high value entered
* by the user
*/
import iopack.Io;
public class Mistake1 {
public static void main(String [] args) {
int sum = 0;
int count = 1;
int high = Io.readInt("Enter the number of squares to sum");
while (count <= high)
sum += count*count;
System.out.println("The sum of the first " + high +
" squares is " +sum);
Io.readString("Press any key to exit"); // Added for IDE use
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -