public class Ninetheen {
/*求1+2!+3!+...+20!的和*/
public static void main(String[] args){
int i,j;
long sum=0,jiecheng=1;
for(i=1;i<=20;i++){
jiecheng=1;
for(j=1;j<=i;j++)
jiecheng=jiecheng*j;
sum=sum+jiecheng;
}
System.out.println("1+2!+3!+...+20!的和是:"+sum);

}

}

  

 

相关文章:

  • 2021-12-12
  • 2021-07-31
  • 2021-08-23
  • 2021-04-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-19
  • 2021-08-06
  • 2021-07-22
  • 2022-12-23
  • 2021-11-04
  • 2021-12-27
相关资源
相似解决方案