Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class program
- {
- static void Main(string[] args)
- {
- List<int> numbers = new List<int>();
- string sum = "sum";
- string exit = "exit";
- bool isWorking = true;
- while (isWorking)
- {
- string userInput = Console.ReadLine();
- if (userInput == sum)
- {
- Console.WriteLine(numbers.Sum());
- }
- else if (userInput == exit)
- {
- isWorking = false;
- }
- else
- {
- numbers.Add(Convert.ToInt32(userInput));
- Console.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement