Advertisement
minilose

Untitled

Jul 18th, 2021
1,436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.  
  12.         static void Main(string[] args)
  13.         {
  14.             var arr = new int[] { 4, 1, 1, 4, 2, 3, 4, 4, 1, 2, 4, 9, 3 };
  15.             var arr2 = new int[15];
  16.             for (int i = 0; i < 15; i++)
  17.             {
  18.                 for (int j = 0; j < arr.Length; j++)
  19.                 {
  20.                     if(i==arr[j])
  21.                     {
  22.                         arr2[i]++;
  23.                     }
  24.                 }
  25.             }
  26.             int temp;
  27.             for (int i = 0; i <arr2.Length-1; i++)
  28.             {
  29.                 for (int j = 0; j <arr2.Length-i-1; j++)
  30.                 {
  31.                     if(arr2[j]<arr2[j+1])
  32.                     {
  33.                         temp = arr2[j];
  34.                         arr2[j] = arr2[j + 1];
  35.                         arr2[j + 1] = temp;
  36.                     }
  37.                 }
  38.             }
  39.             Console.WriteLine(arr2[0]);
  40.         }
  41.     }
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement