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;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = 40, max = 0, current, maxIndex = 0, count = 0, j, sum = 0;
- int[,] arr = new int[n, 30];
- for (int i = 0; i < arr.GetLength(0); i++)
- {
- for (int k = 0; k < arr.GetLength(1); k++)
- {
- arr[i, k] = int.Parse(Console.ReadLine());
- }
- }
- for (int i = 0; i < arr.GetLength(1); i++)
- {
- current = 0;
- for (int k = 0; k < arr.GetLength(0); k++)
- {
- arr[k, i] = int.Parse(Console.ReadLine());
- current += arr[k, i];
- }
- if (current > max)
- {
- maxIndex = i;
- max = current;
- }
- }
- Console.WriteLine("Best selling: " + maxIndex + 1);
- for (int i = 0; i < arr.GetLength(0); i++)
- {
- j = 0;
- while (j < arr.GetLength(1) && arr[i, j] != 0)
- j++;
- if (j == arr.GetLength(1))
- count++;
- }
- Console.WriteLine("Teenagers who own all 30 discs: " + count);
- for (int i = 0; i < arr.GetLength(0); i++)
- {
- for (j = 0; j < arr.GetLength(1); j++)
- sum += arr[i, j];
- }
- Console.WriteLine("Average amount of discs per teen: " + (double)sum / arr.GetLength(0));
- // ד - כן
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement