lab9.cs 565 B

12345678910111213141516171819202122
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace lab_9
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. Console.WriteLine("Введите число заканчивающиеся нулём");//надпись
  13. int sum;
  14. for (sum = 0; int.TryParse(Console.ReadLine(), out int n); sum += n) ;
  15. Console.WriteLine($"Сумма введёных чисел:{sum}");
  16. Console.ReadKey();
  17. }
  18. }
  19. }