Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp777
- {
- class Program
- {
- static int[] array = new int[5] { 3, 3, 3, 3, 3 };
- static int Br (int a)
- {
- int br = 0;
- for(int i = 0; i<5; i++)
- {
- if (a == array[i])
- br++;
- }
- return br;
- }
- static string Golqm(int p)
- {
- string s = "no";
- if (p == 0 && array[p] > array[p + 1])
- s = "yes";
- else
- if (p == array.Length - 1 && array[p] > array[p - 1])
- s = "yes";
- else
- if (p>0 && array[p] > array[p - 1] && array[p] > array[p + 1] )
- s = "yes";
- return s;
- }
- static int First()
- {
- int a = -1;
- int flag = 0;
- if (array[0] > array[1])
- a = 0;
- else
- for(int i = 1; i < 4; i++)
- {
- if(array[i] > array[i-1] && array[i] > array[i + 1])
- {
- a = i;
- flag = 1;
- break;
- }
- }
- if(flag == 0 && array[4]>array[3])
- {
- a = 4;
- }
- return a;
- }
- static void Main(string[] args)
- {
- int a = int.Parse(Console.ReadLine());
- Console.WriteLine("broqt = " + Br(a));
- int poz = int.Parse(Console.ReadLine());
- Console.WriteLine("po golqmo li e chisloto poz - " + Golqm(poz));
- Console.WriteLine("purviq element ima poziciq : " + First());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement