TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Array: Count +ve, -ve, Even & Odd Numbers in C
Mr Shanawar
Jan 25
2016
Code
1.1
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
/*
Name: Author
Date: 14/02/14 12:42
Description: PROGRAM TO COUNT +VE,-VE,EVEN & ODD NUMBERS.
*/
#include<stdio.h>
#include<conio.h>
void
pos(
int
[]);
// pROTOTYPES
void
neg(
int
[]);
void
even_odd(
int
[]);
int
main()
{
int
count;
int
marks[25];
// array declaration
for
(count=0;count<25;count++)
{
printf(
"Enter Number [%d] : "
,count+1);
scanf(
"%d"
,&marks[count]);
}
pos(marks);
//function Call
neg(marks);
//function Call
even_odd(marks);
//function Call
getch();
return
0;
}
// END MAIN
void
pos(
int
post[])
//function definition
{
int
count,incr=0;
for
(count=0;count<25;count++)
{
if
(post[count]>0)
incr;
}
puts(
"\n*.*.*.*.*.*.*.*.*.*.*.*.*.*.*\n"
);
printf(
"\n* %3d Number are Positive *"
,incr);
}
void
neg(
int
negt[])
//function definition
{
int
count,incr=0;
for
(count=0;count<25;count++)
{
if
(negt[count]<0)
incr++;
}
printf(
"\n* %3d Number are Negative *"
,incr);
}
void
even_odd(
int
list[])
//function definition
{
int
count,incr=0,incr1=0;
for
(count=0;count<25;count++)
{
if
(list[count]%2==0)
incr++;
else
incr1++;
}
printf(
"\n* %3d numbers are EVEN *"
,incr);
printf(
"\n* %3d Numbers are Od *"
,incr1);
puts(
"\n\n*.*.*.*.*.*.*.*.*.*.*.*.*.*.*"
);
}
Array
count
positive
negative
even
odd