Advertisement
Vladimir76

задача 11

Jan 6th, 2014
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace InputExitZad11
  7. {
  8.     class InputZad11
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             Console.Write("Entering nomber : ");
  13.             string str = Console.ReadLine();
  14.             int n;
  15.             bool tryParse = int.TryParse(str, out n);
  16.  
  17.             if (tryParse == true)
  18.             {
  19.                 for (int i = 1; i <= n; i++)
  20.                 {
  21.                     Console.WriteLine(i);
  22.                 }
  23.             }
  24.             else
  25.             {
  26.                 Console.WriteLine("Invalid nomber!");
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement