import javax.swing.*;
public class FactorialTest{
public static void main (String args[])
{
int n;
String s=(String)JOptionPane.showInputDialog(null,"请输入整数n","1到n的阶乘",
JOptionPane.PLAIN_MESSAGE,null,null,null);
n=Integer.parseInt(s);
{
long i,t,k;
for(i=1,t=1,k=1;t<=n;t++)
{
k*=t;
}
System.out.println(n+"!="+k);
}
}
}
第7周作业1-循环大战
最新推荐文章于 2022-10-31 21:46:47 发布