【发布时间】:2013-08-15 12:54:37
【问题描述】:
我有一个程序要求输入一个数字 (int x)。然后,用户应该向控制台输入 x 个数字。控制台应该将所有数字加在一起并写出所有输入数字的结果。所以我这样做了:
Console.WriteLine("Enter an number: ");
int x = int.Parse(Console.ReadLine());
for (int i = 0; i < x; i++ )
{
Console.WriteLine("Ange tal {0}: ",i );
double numbers= double.Parse(Console.ReadLine());
}
Console.WriteLine("Sum of the entered numbers are: {0} ",x);
Console.ReadLine();
但结果只给了我最后输入的数字。我做错了什么?
【问题讨论】:
-
+1 编辑拙劣,请见谅。
-
你在哪里把这些数字加在一起? ^^
-
@duDE 在云端! :-) 所有希望都在哪里!!!
-
for (int i = 0; i
标签: c# numbers console-application