write a C program to read a list of n integers count the number of positive and negative integers. Also count the number of Zeroes in the list and display the result.
Answers
Answered by
3
Explanation:
#include <stdio.h>
int main()
{
int number, positive = 0, negative = 0, zero = 0;
char choice;
do
{
printf("Enter a number :");
scanf("%d", &number);
if (number > 0)
{
positive++;
}
else if (number < 0)
{
negative++;
}
else
{
zero++;
}
printf("Do you want to Continue(y/n)? ");
scanf("%c", &choice);
}while (choice == 'y' || choice == 'Y');
printf("\nPositive Numbers :%d\nNegative Numbers :%d\nZero Numbers :%d",
positive, negative, zero);
return 0;
}
Similar questions
Hindi,
2 months ago
History,
5 months ago
Psychology,
5 months ago
Math,
10 months ago
Biology,
10 months ago
Social Sciences,
10 months ago