Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Insert(int[,] Arr)
- {
- Random r = new Random();
- for (int i = 1; i < Arr.GetLength(0); i++)
- {
- for (int j = 0; j < Arr.GetLength(1); j++)
- {
- Arr[0, j] = j + 11;
- Arr[i, j] = r.Next(10000, 100000);
- }
- }
- }
- static void Draw(int[,] Arr)
- {
- for (int i = 0; i < Arr.GetLength(0); i++)
- {
- for (int j = 0; j < Arr.GetLength(1); j++)
- {
- Console.Write(Arr[i, j] + " | ");
- }
- Console.WriteLine();
- }
- }
- static int FindCode(int[,] Arr, int locker)
- {
- int code = Arr[1, locker - 11];
- return code;
- }
- static void Main(string[] args)
- {
- int[,] Arr = new int[2, 89];
- Insert(Arr);
- Draw(Arr);
- Console.WriteLine();
- Console.WriteLine("Enter the number of your locker: ");
- int input = int.Parse(Console.ReadLine());
- int code = FindCode(Arr, input);
- Console.WriteLine("Your code is : " + code);
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment