Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Array: Count +ve, -ve, Even & Odd Numbers in C
WhatsApp
Mr Shanawar
Jan 25
2016
1.2
k
0
0
/*
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
Up Next
Array: Count +ve, -ve, Even & Odd Numbers in C