数値 (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();
しかし、結果は最後に入力された番号のみを提供します。私は何を間違っていますか?