Advertisement
bacco

Count the Integers (while (true))

May 16th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.45 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ΠšΡƒΠΏΠ°
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.            var counter = 0;
  10.  
  11.            try
  12.            {
  13.               while (true)
  14.                {
  15.                    int integer = int.Parse(Console.ReadLine());
  16.                    counter++;
  17.                }
  18.            }
  19.            catch
  20.            {
  21.                Console.WriteLine(counter);
  22.            }
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement