Advertisement
rosenrusev

Example - Two dimensional array

Mar 11th, 2014
1,331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using System.Text;
  4.  
  5. namespace Two_dimensional_array
  6. {
  7. class TwoDimentionalArray
  8. {
  9. static void Main(string[] args)
  10. {
  11. int[,] numberApartments = {{400, 401, 402, 403},
  12. {300, 301, 302, 303},
  13. {200, 201, 202, 203},
  14. {100, 101, 102, 103}};
  15. int floor, apartments;
  16. string inputString;
  17.  
  18. Console.Write("Enter the floor on which you live: ");
  19. inputString = Console.ReadLine();
  20. floor = Convert.ToInt32(inputString);
  21. Console.Write("Enter the number of apartament you want to be checked: ");
  22. inputString = Console.ReadLine();
  23. apartments = Convert.ToInt32(inputString);
  24. Console.WriteLine("The apartment when you think that is your husband is \n{0}", numberApartments[floor,apartments]);
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement