- 最後登錄
- 2024-4-26
- 在線時間
- 9252 小時
- 註冊時間
- 2004-5-23
- 閱讀權限
- 200
- 精華
- 14
- UID
- 5
- 帖子
- 15722
- 積分
- 28040 點
- 潛水值
- 400329 米
| - // IVE Lab 7-6
- public class Lab_7_6_sum_of_integer__2 {
-
- static int result;
- static int num;
-
- public static void main(String[] args) {
-
- result = 0;
- for(num = 1; num <= 20; num++) {
-
- if(num == 10 || num == 11) {
- continue;
- } else {
- result += num;
- }
- }
- System.out.println("The sum of number 1-20 is " + result + ".\nThe last number have been add is " + num);
- }
- }
複製代碼 ... |
附件: 你需要登錄才可以下載或查看附件。沒有帳號?註冊 |