Skip to content

Commit 7178235

Browse files
authored
Number check
1 parent 671754a commit 7178235

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

array num check.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <stdio.h>
2+
int main()
3+
{
4+
int a[10],i,n,cp=0,cn=0,ce=0,co=0;
5+
for(i=0;i<10;i++){
6+
printf("Enter %d element:",i);
7+
scanf("%d",&n);
8+
}
9+
for(i=0;i<10;i++){
10+
if(i>0){
11+
cp++;
12+
if(i%2==0)
13+
ce++;
14+
else
15+
co++;
16+
}
17+
else
18+
cn++;
19+
20+
}
21+
printf("Count of positive numbers is %d\n",cp);
22+
printf("Count of neagative numbers is %d\n",cn);
23+
printf("Count of odd numbers is %d\n",co);
24+
printf("Count of even numbers is %d",ce);
25+
return 0;
26+
}

0 commit comments

Comments
 (0)