Advertisement
skipter

C# Count Occurrences of Larger Numbers in Array

Jun 23rd, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 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. namespace _12.LergerNumsInArray
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             double[] elements = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
  13.           //  double[] elements = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
  14.             double specialNum = double.Parse(Console.ReadLine());
  15.             int counter = 0;
  16.             for (int cnt = 0; cnt < elements.Length; cnt++)
  17.             {
  18.                 if (elements[cnt] > specialNum)
  19.                 {
  20.                     counter++;
  21.                 }                
  22.             }
  23.             Console.WriteLine(counter);
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement