11:54 PM 2009-2010 question 2 |
write a program that read n integer values and pass them one at a time to a function called evenodd to determine if value is even or odd ,, also another function called negative to determine if value is positive or negative
#include<stdio.h>
void evenodd(int x;);
void negative(int y;);
main()
{
int n, val, i;
printf("enter n of values : ");
scanf("%d", &n);
for(i=1;i<=n;i++){
printf("enter value no. %d : ", i);
scanf("%d", &val);
evenodd(val);
negative(val);
printf("\n");
}
getch();
return 0;
}
void evenodd(int x)
{
if(x%2==0)
printf(" even ");
else
printf(" odd ");
}
void negative(int y)
{
if(y>=0)
printf(" positive ");
else
printf(" negative ");
}
|
|
Total comments: 0 | |