Advertisement
martinvalchev

Count_the_Integers

Jan 29th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Count_the_Integers
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.            
  10.             int counter = 0;
  11.            
  12.  
  13.  
  14.             while (true)
  15.             {
  16.                 try
  17.                 {
  18.                    int integer = int.Parse(Console.ReadLine());
  19.                     counter++;
  20.                    
  21.                 }
  22.                 catch (Exception)
  23.                 {
  24.                     Console.WriteLine(counter);
  25.                     return;
  26.  
  27.                 }
  28.                
  29.             }
  30.            
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement