Hello,
I am brand new to programming in C and am having some trouble with a very simple program. I am attemting to find the average, sum and product of two numbers (taken as paramaters). The code compiles but gives obviously wrong results.
the ouput is:
The sum is 4013265
The product is 4013264
The Average is 2006632
Any help Would be appreaciated. Feel free to criticise my code.
Thanks.
Code:
int main(int n1,int n2)
{
int o1=n1+n2; /* o1, o2, 03 are output variables */
int o2=(n1*n2);
int o3=((n1+n2)/2);
printf("The sum is %d \n",o1 );
printf("The product is %d \n", o2);
printf("The Average is %d \n",o3);
exit(0);
}