Advertisement
DaniPasteBin

Untitled

May 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _9.CountTheIntegers
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.  
  9.         {
  10.             int counter = 0;
  11.             for (int i = 0;; i++)
  12.             {
  13.                 try
  14.                 {
  15.                     var data = int.Parse(Console.ReadLine());
  16.                     counter++;
  17.  
  18.                 }
  19.                 catch (Exception)
  20.                 {
  21.                     Console.WriteLine(counter);
  22.                     break;
  23.                    
  24.                 }
  25.                
  26.             }
  27.            
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement