/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author lenovo
*/
public class PrintJieCheng {
int i=1,s=1,sum=0;
int getResult()
{
while(i<=20)
{
s*=i;
sum+=s;
i++;
}
return sum;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author lenovo
*/
public class Test {
public static void main(String args[]){
PrintJieCheng a=new PrintJieCheng();
int result=a.getResult();
System.out.println("Result is "+ result);
}
}
阶乘
最新推荐文章于 2023-02-19 21:46:02 发布