Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.14 KB | None | 0 0
  1.  static void Main(string[] args)
  2.         {
  3.  
  4.             Console.Write("Hello please enter the max number: ");
  5.             int max = int.Parse(Console.ReadLine());
  6.  
  7.             Console.Write("\nHello please enter the min number: ");
  8.             int min = int.Parse(Console.ReadLine());
  9.  
  10.             Random rnd = new Random();
  11.  
  12.             int[,] math = new int[max, min];
  13.             for (int i = 0; i < math.GetLength(0); i++)
  14.             {
  15.                 for (int j = 0; j < math.GetLength(1); j++)
  16.                 {
  17.                     math[i,j] = rnd.Next(20,101);
  18.                 }
  19.             }
  20.  
  21.  
  22.             for (int i = 0; i < math.GetLength(0); i++)
  23.             {
  24.                 for (int j = 0; j < math.GetLength(1); j++)
  25.                 {
  26.                     Console.Write("[{0},{1}]={2}\t", i, j, math[i, j]);  
  27.                 }
  28.             }
  29.  
  30.             methMax(math);
  31.             methMin(math);
  32.             methRaw();
  33.             methColum();
  34.        
  35.  
  36.         }
  37.  
  38.      
  39.         private static void methColum()
  40.         {
  41.             throw new NotImplementedException();
  42.         }
  43.  
  44.         private static void methRaw()
  45.         {
  46.             throw new NotImplementedException();
  47.         }
  48.  
  49.         private static int methMin(int[,] math)
  50.         {
  51.             int minnum = 99999999;
  52.             for (int i = 0; i < math.GetLength(0); i++)
  53.             {
  54.                 for (int j = 0; j < math.GetLength(1); j++)
  55.                 {
  56.                     if (math[i, j] < minnum)
  57.                     {
  58.                        minnum = math[i, j];
  59.                     }
  60.                 }
  61.             }
  62.  
  63.  
  64.             return minnum;
  65.         }
  66.  
  67.          static int methMax(  int[,] math)
  68.         {
  69.             int maxnum = 0;
  70.             for (int i = 0; i < math.GetLength(0); i++)
  71.             {
  72.                 for (int j = 0; j < math.GetLength(1); j++)
  73.                 {
  74.                     if (math[i,j] > maxnum)
  75.                     {
  76.                         maxnum = math[i, j];
  77.                     }
  78.                 }
  79.             }
  80.          
  81.  
  82.             return maxnum;
  83.         }
  84.     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement