Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class MainClass
- {
- public static void Main(string[] args)
- {
- int chislo = 0;
- VvodChisla(ref chislo);
- Console.WriteLine("Вы ввели число: " + chislo);
- Console.ReadKey();
- }
- public static int VvodChisla(ref int chislo)
- {
- while(true)
- {
- Console.Write("Введите число: ");
- bool preobrazovane = int.TryParse(Console.ReadLine(), out chislo);
- Console.Clear();
- if (preobrazovane)
- {
- return chislo;
- }
- else
- {
- Console.WriteLine("Вы ввели что-то не то!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement