using System.Collections.Generic;
public static void Main()
int[,] index= new int[10,10];
int[] arr= {1,2,3,4,5,6,7,8,9,0};
Program obj= new Program();
Console.WriteLine("Please Enter a 3 digit number");
int passkey=Convert.ToInt32(Console.ReadLine()) ;
if(passkey.ToString().Length!=3)
Console.WriteLine("\nPlease enter a valid 3 digit number");
var password= obj.inttoarray(passkey);
Console.WriteLine("\nEnter a position number(between 0-9)");
int position=Convert.ToInt32(Console.ReadLine()) ;
if(position.ToString().Length!=1)
Console.WriteLine("\nPlease enter a valid position number(between 0-9)");
Console.WriteLine("\nYour password is saved successfully\n\n ");
Console.WriteLine("\n Now we are going to set up secret questions. This will help incase your account is locked.");
Console.WriteLine("\n 1) What is your favourite city\n");
string city= Console.ReadLine().ToUpper();
Console.WriteLine("\n 1) What is your favourite colour\n");
string color=Console.ReadLine().ToUpper();
Console.WriteLine("\nCongratulations.Now you can go for login \n\n ");
Console.WriteLine("\n 1) What is your favourite city\n");
string City1= Console.ReadLine().ToUpper();
Console.WriteLine("\n 1) What is your favourite colour\n");
string Color1=Console.ReadLine().ToUpper();
if(City1==city && Color1==color)
Console.WriteLine("\n Account is unlocked\n\n");
Console.WriteLine("\n Please enter grid pin\n\n");
Console.Write(index[i,j]+" ");
Console.WriteLine("\nSorry you made 3 wrong attempts.Account is locked.Type and enter as shazam for unlocking account");
string unlock=Console.ReadLine().ToUpper();
int gridpin=Convert.ToInt32(Console.ReadLine()) ;
res[k]= index[i,position-1];
int f_res=obj.arraytoint(res);
Console.WriteLine("\n Correct Gridpin . You have logged in");
Console.WriteLine("\n if you want to log off ,please type and enter as logoff");
string logoff=Console.ReadLine().ToUpper();
Console.WriteLine("\n Wrong Gridpin (Attempt:"+attempt+") Please try again");
public int[] inttoarray(int num)
List<int> digits = new List<int>();
var arr = digits.ToArray();
public int arraytoint(int[] num)
for (int i=0;i<num.Length;i++)