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 Input(int[] Arr)
- {
- int x;
- for (int i = 0; i < 7; i++)
- {
- Console.WriteLine("Enter a grade :)");
- x = int.Parse(Console.ReadLine());
- Arr[x]++;
- }
- }
- //-----------------------------------------
- static void Pop(int[] Arr1, int[] Arr2)
- {
- for (int i = 0; i < Arr1.Length; i++)
- {
- Arr2[(Arr1[i]/ 10) % 100]++;
- }
- }
- //-----------------------------------------
- static void Main(string[] args)
- {
- int[] grades = new int[101];
- int[] popular = new int[10];
- Input(grades);
- Pop(grades, popular);
- //-----------------------------------------
- for (int i = 0; i < grades.Length; i++)
- {
- if (grades[i] > 0)
- {
- Console.Write(i + " ");
- Console.WriteLine(grades[i]);
- }
- }
- //-----------------------------------------
- int best = int.MinValue;
- for (int i = 0; i < popular.Length; i++)
- {
- best = Math.Max(best, popular[i]);
- }
- Console.WriteLine(best);
- Console.ReadLine();
- }
- }
- }
Add Comment
Please, Sign In to add comment