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 CSLight2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int number;
- bool correct = false;
- while(correct == false)
- {
- Console.Write("Ведите данные: ");
- string userInput = Console.ReadLine();
- if (int.TryParse(userInput, out number))
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("\nВы ввели число: {0}", number);
- Console.ResetColor();
- correct = true;
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("\nВы ввели не число!");
- Console.ResetColor();
- Console.ReadKey();
- Console.Clear();
- }
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment