Advertisement
Stanislav2812

Untitled

Aug 16th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 KB | None | 0 0
  1. //Цикл for лучше использовать когда количество итераций заранее известно. Пример ниже.
  2.             //Console.WriteLine("Привет! Как тебя зовут?");
  3.             //string userName = Console.ReadLine();
  4.             //Console.WriteLine("Сколько тебе лет?");
  5.             //int userAge = Convert.ToInt32(Console.ReadLine());
  6.             //for(int i = 0; i < userAge; i++)
  7.             //{
  8.             //    Console.WriteLine("С днем рождения " + userName + "!");
  9.             //}
  10.            
  11.             //Цикл while лучше использовать когда количество итераций неизвестно, как в примере ниже только без счетчика.
  12.             //Console.WriteLine("Введите пароль");
  13.             //string userPassword = Console.ReadLine();
  14.             //int password = 1234;
  15.             //int i = 0;
  16.  
  17.             //while (i < 4 && password != Convert.ToInt32(userPassword))
  18.             //{
  19.             //    Console.WriteLine("Попробуй еще раз");
  20.             //    userPassword = Console.ReadLine();
  21.             //    i++;
  22.             //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement