The elements of the array are taken as inputs from the user. **This program finds how many negative numbers are present in the array**. If an element is less than 0 means the element is the negative element and a variable is taken to count the number of negative elements.

INPUT: Array elements

OUTPUT: the number of negative elements of the array

PROCESS:

Step 1: [taking the input]

Read n [number of elements]

For i=0 to n-1 repeat

Read a[i]

[end of ‘for’ loop]

Step 2: [finding the number of negative elements]

Set count<-0

For i=0 to n-1 repeat

If a[i]<0 then

Set count<-count+1

[End of ‘if’]

[End of ‘for’ loop]

Print count

Step 3: Stop.

The **time complexity to take the number of elements** is **O(n)** and the **time complexity to count the negative numbers** is also **O(n)**.

Related

- Find Maximum and Minimum from an array
- Kth Largest and Smallest Element
- 2nd largest element from the array
- The elements of the one array are copied to another array.
- Delete element from any position in array
- Frequency of each element in the Array
- Find out the unique elements from the Array
- Finds odd and even elements from the array and stored in two separate arrays
- Counts the number of odd and even elements separately from the array
- Reverses the elements of an Array
- Merge two Array and stored in the third Array
- Rotated the Array at left
- Rotated the Array right
- Sorted the array and then separate even and odd elements in different array
- Sort number of strings in an array
- Check one given element of an array present more than n/2 times or not.
- Sum of the elements of an Array is calculated using a pointer
- The union and intersection between the two given arrays