luc055.c ​
Metadata ​
- Author — Amit Dutta
- Last updated — 08 Feb 2026
- License — MIT License (See the LICENSE file for details)
Problem Statement ​
Problem Statement
Twenty-five numbers are entered from the keyboard into an array. Write a program to find out how many of them are positive, how many are negative, how many are even and how many odd.
Source Code ​
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
c
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main()
{
int arr[25], i;
int pos = 0, neg = 0, even = 0, odd = 0;
printf("Enter 25 integers:\n");
for (i = 0; i < 25; i++)
{
scanf("%d", &arr[i]);
if (arr[i] > 0)
pos++;
else if (arr[i] < 0)
neg++;
if (arr[i] % 2 == 0)
even++;
else
odd++;
}
printf("\nResults:\n");
printf("Positive: %d\n", pos);
printf("Negative: %d\n", neg);
printf("Even: %d\n", even);
printf("Odd: %d\n", odd);
return 0;
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33