program to enter a list of number between 1 to n and count the total number of positive and negative numbers from it...
Share
program to enter a list of number between 1 to n and count the total number of positive and negative numbers from it...
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Answer:
C program to count Positive and Negative numbers in an Array
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.
hope it works out for you
thanks