/*
* 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 GetResult {
int i=0,s=1,sum=0;
int Result(){
while(sum<=9999)
{
s*=i;
sum+=s;
i++;
}
return i-1;
}
}
/*
* 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[]){
GetResult a=new GetResult();
int result=a.Result();
System.out.println(" "+result);
}
}
阶乘之和小于10000的整数
最新推荐文章于 2022-11-03 20:21:56 发布