Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Clight_16_ReadInt
- {
- class Program
- {
- static void Main(string[] args)
- {
- bool actualNum = false;
- while (actualNum == false)
- {
- EnterNumber(actualNum);
- Console.Clear();
- }
- }
- static void EnterNumber(bool actualNum)
- {
- Console.Write("Введите число: ");
- string tempNum = Console.ReadLine();
- int number;
- bool goodNum = Int32.TryParse(tempNum, out number);
- if (goodNum)
- {
- actualNum = true;
- Console.WriteLine("\nВаше число: " + number);
- Console.ReadKey();
- }
- else
- {
- Console.WriteLine("\nПопробуйте еще раз.");
- Console.ReadKey();
- Console.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement