Advertisement
AlexTasev

09_CountTheIntegers

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