?? ex2_6.java
字號:
import javax.swing.JOptionPane;/* * To change this template, choose Tools | Templates * and open the template in the editor. *//** * * @author xiaolei */public class EX2_6 { public static void main(String[] args) { int num, sum = 0; num = Integer.parseInt(JOptionPane.showInputDialog("輸入0-1000之間的整數(shù):")); if((num < 0) || (num > 1000)){ JOptionPane.showMessageDialog(null, "錯誤的輸入值:"+num); System.exit(0); } while(num != 0){ sum += num % 10; num = num / 10; } JOptionPane.showMessageDialog(null, "結(jié)果:"+sum); }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -