Advertisement
YavorGrancharov

Count_of_Negative_Elements_in_Array

Jun 16th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 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_of_Negative_Elements_in_Array
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.  
  15.             var array = new int[n];
  16.  
  17.             int i, count = 0;
  18.  
  19.             for (i = 0; i < n; i++)
  20.             {
  21.                 array[i] = int.Parse(Console.ReadLine());
  22.  
  23.                 if (array[i] < 0)
  24.                 {
  25.                     count++;
  26.                 }
  27.             }
  28.             Console.WriteLine(count);
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement