Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Еnter a number in the range [1...100]: ");
- int n = int.Parse(Console.ReadLine()); // Прочитаме числото
- // В while-цикъла ще се влезе само в случай, че числото n не е в диапазона [1 ... 100]
- while (n<1||n>100)
- {
- Console.WriteLine("Invalid number!");
- Console.Write("Еnter a number in the range [1...100]: ");
- n = int.Parse(Console.ReadLine()); // Прочитаме числото отново, тъй като не е било в диапазона [1 ... 100]
- }
- Console.WriteLine("The number is: {0}", n); // Изписваме числото
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement