求1!+2!+3!+……20!
using System; class jiecheng { static void Main() { long i=1; long j=1; long m=0; for (j=1;j<=20;j++) { i=i*j; Console.WriteLine(i); m+=i; } Console.WriteLine("所求的总和是:"+m); System.Threading.Thread.Sleep(80000000); } }
using System; class jiecheng { static void Main() { long i=1; long j=1; long m=0; for (j=1;j<=20;j++) { i=i*j; Console.WriteLine(i); m+=i; } Console.WriteLine("所求的总和是:"+m); System.Threading.Thread.Sleep(80000000); } }