Advertisement
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;
- using System.Threading.Tasks;
- namespace ConsoleApplication7
- {
- class Program
- {
- static void Main(string[] args)
- {
- int suma = 0;
- int ind1=0;
- int ind2 = 0;
- Console.WriteLine("Unesite dimenziju kvadratne matrice");
- int vel = int.Parse(Console.ReadLine());
- int[,] niz = new int[vel, vel];
- for (int i = 0; i < vel; i++)
- for (int j = 0; j < vel; j++)
- niz[i, j] = int.Parse(Console.ReadLine());
- int sumamin = int.MaxValue;
- for (int i = 0; i < vel; i++)
- {
- suma = 0;
- for (int j = 0; j < vel; j++)
- {
- suma += niz[i, j];
- }
- if (suma < sumamin) { sumamin = suma; ind1 = i; }
- }
- int sumamax = int.MinValue;
- for (int j = 0; j < vel; j++)
- {
- suma = 0;
- for (int i = 0; i < vel; i++)
- {
- suma = niz[i, j];
- }
- if (suma > sumamax) { sumamax = suma; ind2 = j; }
- }
- suma = 0;
- for (int i = 0; i < vel; i++)
- {
- for (int j = 0; j < vel; j++)
- {
- if (i == j)
- suma += niz[i, j];
- }
- }
- Console.WriteLine("{0}, {1},{2}", ind1, ind2, suma);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement