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 ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- var arr = new int[] { 4, 1, 1, 4, 2, 3, 4, 4, 1, 2, 4, 9, 3 };
- var arr2 = new int[15];
- for (int i = 0; i < 15; i++)
- {
- for (int j = 0; j < arr.Length; j++)
- {
- if(i==arr[j])
- {
- arr2[i]++;
- }
- }
- }
- int temp;
- for (int i = 0; i <arr2.Length-1; i++)
- {
- for (int j = 0; j <arr2.Length-i-1; j++)
- {
- if(arr2[j]<arr2[j+1])
- {
- temp = arr2[j];
- arr2[j] = arr2[j + 1];
- arr2[j + 1] = temp;
- }
- }
- }
- Console.WriteLine(arr2[0]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement