Guest User

Untitled

a guest
May 17th, 2018
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace p18_9
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int[]a=new int[5];
  13.             for (int i = 0; i < 5; i++)
  14.             {
  15.                 a[i] = int.Parse(Console.ReadLine());
  16.             }
  17.             int min=a[0], max=a[0], count = 0, pmax = 0;
  18.             for (int i = 0; i < 5; i++)
  19.             {
  20.                 if (a[i] > max) { max = a[i]; pmax = i+1; }
  21.                 if (a[i] < min) { min = a[i];}
  22.             }
  23.             for (int i = 0; i < 5; i++)
  24.                 if (a[i] == max)
  25.                     count++;
  26.             Console.WriteLine(min + " " + max + " " + pmax + " " + count);
  27.         }
  28.     }
  29. }
Add Comment
Please, Sign In to add comment