Ok I got the program to run now. The only problem I am having is a logical one. For the first part I am not sure how I can find out what the largest number is. Second right now the program is priting out crazy answers.
Code:
#include<stdio.h>
int count(int *sumOdd, int *SumEven, int *largerst);
void printresult(int tot, int sum1, int sum2, int max);
int main()
{
int sumo,sume,large,a1,a2,a3,a4;
count(&sumo,&sume,&large);
printresult(a1,sumo,sume,large);
}
int count(int *sumOdd, int *SumEven, int *largerst)
{
int num,check,ignore;
do{
printf("Enter as many integers as you like(0 to exit)");
scanf("%d",&num);
if(num<0)
{
ignore=num-num;
}
else if(num%2==0)
{
*SumEven=num+num;
}
else
{
*sumOdd=num+num;
}
check=check+1;
}while(num!=0);
return check;
}
void printresult(int tot, int sum1, int sum2, int max)
{
printf("You entered %d numbers\n",tot);
printf("The sum of of even is %d\n",sum2);
printf("The sum of odd is %d\n",sum1);
printf("the largest number is %d\n",max);
}
I entered in numbers,5 2 and 0.
My result:
4199232 numbers entered
10 is the odd sum
0 is the even sum
-1 is the largest number