Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- int PassCode = 7898;
- Console.Write("Enter the PassCode: ");
- string input = Console.ReadLine();
- int output;
- bool Validation = int.TryParse(input, out output);
- bool check = PassCode == output;
- while (!check)
- {
- if(check)
- {
- Console.WriteLine("Correct PassCode");
- }
- else if (!check)
- {
- for (int i = 0; i < 2; i++)
- {
- if (check == false)
- {
- Console.WriteLine("Wrong PassCode");
- Console.Write("Enter the PassCode: ");
- input = Console.ReadLine();
- Validation = int.TryParse(input, out output);
- check = PassCode == output;
- }
- else if(check==true)
- {
- continue;
- }
- }
- if (check == false)
- {
- Console.WriteLine("Program Blocked!");
- break;
- }
- }
- }
- if(check == true)
- {
- Console.WriteLine("Correct PassCode");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement