Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace App
- {
- class Program
- {
- static void Main()
- {
- int divison, cashier, payment = 0, max = 0, maxIndex = 0, min = int.MaxValue, currentSum, minIndex = 0, sum = 0;
- int[,] shop = new int[6, 5];
- for (int i = 0; i < shop.GetLength(0); i++)
- {
- for (int k = 0; k < shop.GetLength(1); k++)
- shop[i, k] = 0;
- }
- while (payment != -1)
- {
- divison = int.Parse(Console.ReadLine());
- cashier = int.Parse(Console.ReadLine());
- payment = int.Parse(Console.ReadLine());
- shop[divison, cashier] += payment;
- }
- for (int i = 0; i < shop.GetLength(0); i++)
- {
- for (int k = 0; k < shop.GetLength(1); k++)
- {
- if (shop[i, k] > max)
- {
- maxIndex = i * 10 + k;
- max = shop[i, k];
- }
- }
- }
- Console.WriteLine("Divison: {0} cashier: {1}", maxIndex / 10 + 1, maxIndex % 10 + 1);
- for (int i = 0; i < shop.GetLength(0); i++)
- {
- currentSum = 0;
- for (int k = 0; k < shop.GetLength(1); k++)
- currentSum += shop[i, k];
- if (currentSum < min)
- {
- min = currentSum;
- minIndex = i + 1;
- }
- }
- Console.WriteLine("Division with minimal income: " + minIndex);
- for(int i = 0; i < shop.GetLength(0); i++)
- {
- for (int k = 0; k < shop.GetLength(1); k++)
- sum += shop[i, k];
- }
- Console.WriteLine("Total income: " + sum);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement