C#编程问题

[复制链接]
查看11 | 回复1 | 2010-4-18 23:52:29 | 显示全部楼层 |阅读模式
新建一个控制台程序using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace baidu{
class Program
{
static void Main(string[] args)
{
double anwser=0;
int input = Convert.ToInt32(Console.ReadLine());
for (int j = 1; j < input + 1; j++)
{
anwser += foo(j);
}
Console.WriteLine(anwser);
Console.ReadKey();
}
static double foo(int number)
{
double temp=1;
for(int i=1;i<number+1;i++)
{
temp *= i;
}
return temp;
}
}}
回复

使用道具 举报

千问 | 2010-4-18 23:52:29 | 显示全部楼层
参考下看看
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行