Advertisement
EmoRz

Number in Range [1...100]

Aug 22nd, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.33 KB | None | 0 0
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         var n = int.Parse(Console.ReadLine());
  8.        
  9.         while( n < 1 || n > 100)
  10.         {
  11.             Console.WriteLine("Invalid number");
  12.             Console.WriteLine("Try again");
  13.             n = int.Parse(Console.ReadLine());         
  14.         }
  15.         Console.WriteLine("Valid number= "+n);     
  16.            
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement