SHARE
TWEET

06.09 Count The Integers

chesten5139 Sep 27th, 2017 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _09.CountTheIntegers
  8. {
  9.     class CountTheIntegers
  10.     {
  11.         static void Main()
  12.         {
  13.             int counter = 0;
  14.             int inputNumber = 0;
  15.             while(true)
  16.             {
  17.                 bool isInt = int.TryParse(Console.ReadLine(), out inputNumber);
  18.                 if (!isInt)
  19.                 {
  20.                     break;
  21.                 }
  22.                 counter += 1;
  23.             }
  24.  
  25.             Console.WriteLine(counter);
  26.         }
  27.     }
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top