Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace WHILE_OneToHundred
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Enter a number in the range [1...100]: ");
- int num = int.Parse(Console.ReadLine());
- while (num < 1 || num > 100)
- {
- Console.WriteLine("Invalid number!");
- Console.WriteLine("Enter a number in the range [1...100]: ");
- Console.ReadLine();
- }
- Console.WriteLine("The number is: {0}", num);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment