Topic: 求1到10的阶层

  Print this page

1.求1到10的阶层 Copy to clipboard
Posted by: 丫丫
Posted on: 2007-09-14 16:15

public class jc
{
public static void main(String []args)
{
long a=1,sum=0;

for(int i=1;i<=10;i++)
{
a=a*i;
sum+=a;
}
System.out.println("1!+2!+...10!="+sum);
}
}


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923