CJCoding With Joseph
15free / daySign inCreate account

Count Negative Numbers

The program reads an integer n, then reads n integers into an array. Count how many of them are negative (less than 0) and print that single count.

For the input 7 followed by 4 -2 7 -8 -1 3 0, print the output shown in Expected Output.

Print only the number followed by a newline.

Expected Output:

3

= newline. The output ends with a newline — print one after the last line.

Hints3 available
Topics:
Arrays
📥 Auto-Input:
7\n4 -2 7 -8 -1 3 0\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.