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 _06.Number_in_Range_ot1do100
- {
- class Program
- {
- static void Main(string[] args)
- {
- //Console.Write("Enter a number in the range [1 ... 100]: ");
- int num = int.Parse(Console.ReadLine());
- while (num < 1 || num > 100)
- {
- Console.WriteLine("Invalid number");
- Console.Write("Enter a number in the range [1 ... 100]: ");
- num = int.Parse(Console.ReadLine());
- }
- Console.WriteLine($"The number is: {num}");
- //вариант първи
- /*if (num >= 1 && num <= 100)
- {
- Console.WriteLine($"The number is: {num}");
- }
- else
- {
- Console.WriteLine("Invalid number");
- }*/
- /*for (int i = 0; i <= 100; i++)
- {
- Console.Write("Enter a number in the range [1 ... 100]: ");
- int num = int.Parse(Console.ReadLine());
- if (num % 2 == 0 && num >= 0 && num <= 100)
- {
- Console.WriteLine($"The number is: {num}");
- }
- else
- {
- Console.WriteLine("Invalid number");
- }
- }*/
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement