Osszegzo

Anonymous
csharp
10/16/2023 7:35 PM
752 B
19
Indexable
using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        List<int> numbers = new List<int>();
        int input;
        int sum = 0;

        while (true)
        {
            Console.Write("Adjon meg egy számot (0 a összegzéshez): ");
            input = int.Parse(Console.ReadLine());
            numbers.Add(input);
            sum += input;
            if (input == 0)
            {
                Console.WriteLine("Korábbi számok összege: " + sum);
                break;
            }
        }
    }
}
Editor is loading...