Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace advanced_loops
- {
- class Program
- {
- static void Main(string[] args)
- {
- while (true)
- {
- Console.WriteLine("Enter a number in range [1...100]");
- int num = int.Parse(Console.ReadLine());
- if (num >= 1 && num <= 100)
- {
- Console.WriteLine($"The number is: {num}");
- break;
- }
- else
- {
- Console.WriteLine("Invalid number!");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement