Advertisement
chesten5139

06.09 Count The Integers

Sep 27th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement