MuffinMonster

Class Task 46#

Jan 8th, 2014
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.54 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static void Input(int[] Arr)
  11.         {
  12.             int x;
  13.             for (int i = 0; i < 7; i++)
  14.             {
  15.                 Console.WriteLine("Enter a grade :)");
  16.                 x = int.Parse(Console.ReadLine());
  17.                 Arr[x]++;
  18.             }
  19.         }
  20.         //-----------------------------------------
  21.         static void Pop(int[] Arr1, int[] Arr2)
  22.         {
  23.             for (int i = 0; i < Arr1.Length; i++)
  24.             {
  25.                 Arr2[(Arr1[i]/ 10) % 100]++;
  26.             }
  27.         }
  28.         //-----------------------------------------
  29.         static void Main(string[] args)
  30.         {
  31.             int[] grades = new int[101];
  32.             int[] popular = new int[10];
  33.             Input(grades);
  34.             Pop(grades, popular);
  35.             //-----------------------------------------
  36.             for (int i = 0; i < grades.Length; i++)
  37.             {
  38.                 if (grades[i] > 0)
  39.                 {
  40.                     Console.Write(i + " ");
  41.                     Console.WriteLine(grades[i]);
  42.                 }
  43.             }
  44.             //-----------------------------------------
  45.             int best = int.MinValue;
  46.             for (int i = 0; i < popular.Length; i++)
  47.             {
  48.                 best = Math.Max(best, popular[i]);
  49.             }
  50.             Console.WriteLine(best);
  51.             Console.ReadLine();
  52.         }
  53.     }
  54. }
Add Comment
Please, Sign In to add comment