Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace legnagyobbelem
- {
- class Program
- {
- static void Main(string[] args)
- {
- while (true)
- {
- Console.Write("Sorok szama: ");
- int m = int.Parse(Console.ReadLine());
- Console.Write("Oszlopok szama: ");
- int n = int.Parse(Console.ReadLine());
- if (m == 0 || n == 0) break;
- int[,] mat = new int[m, n];
- Console.WriteLine("Matrix beolvasasa ");
- for (int i = 0; i < m; i++)
- {
- for (int j = 0; j < n; j++)
- {
- mat[i, j] = int.Parse(Console.ReadLine());
- }
- }
- int mi = 0, mj = 0;
- for (int i = 0; i < m; i++)
- {
- for (int j = 0; j < n; j++)
- {
- if (mat[i,j] > mat[mi,mj])
- {
- mi = i;
- mj = j;
- }
- }
- }
- Console.WriteLine("Matrix legnagyobb eleme [{0},{1}] = {2}", mi, mj, mat[mi, mj]);
- Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement