Write a program to accept 'n' integers and find out :
i. a number of positive numbers
ii. the number of negative numbers
iii. the sum of positive numbers
Answers
Answer:
Given an array arr of integers of size N, the task is to find the count of positive numbers and negative numbers in the array
Examples:
Input: arr[] = {2, -1, 5, 6, 0, -3}
Output:
Positive elements = 3
Negative elements = 2
There are 3 positive, 2 negative, and 1 zero.
Input: arr[] = {4, 0, -2, -9, -7, 1}
Output:
Positive elements = 2
Negative elements = 3
There are 2 positive, 3 negative, and 1 zero.
Answer:
Explanation:
Given an array arr of integers of size N, the task is to find the count of positive numbers and negative numbers in the array
Examples:
Input: arr[] = {2, -1, 5, 6, 0, -3}
Output:
Positive elements = 3
Negative elements = 2
There are 3 positive, 2 negative, and 1 zero.
Input: arr[] = {4, 0, -2, -9, -7, 1}
Output:
Positive elements = 2
Negative elements = 3
There are 2 positive, 3 negative, and 1 zero.