Advertisement
YavorGrancharov

Count_Occurrences_of_Larger_Numbers_in_Array

Jun 16th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 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 Count_Occurrences_of_Larger_Numbers_in_Array
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var array = Console.ReadLine().Split().ToArray();
  14.             var newArray = Array.ConvertAll(array, double.Parse);
  15.  
  16.             var check = double.Parse(Console.ReadLine());
  17.  
  18.             var count = 0;
  19.  
  20.             foreach (var num in newArray)
  21.             {
  22.                 if (num > check)
  23.                 {
  24.                     count++;
  25.                 }
  26.             }
  27.             Console.WriteLine(count);
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement