Monday, October 31, 2005

更改版的lab1

import javax.swing.JOptionPane;
public class pan1{

public static void main(String[] args)
{int x=1;

String a = JOptionPane.showInputDialog("打一個數字");
int n = Integer.parseInt(a);
while(n>=0){
x*=n;
a = JOptionPane.showInputDialog("打一個數字");
n = Integer.parseInt(a);
}
System.out.println(x);


}
}

0 Comments:

Post a Comment

<< Home