i wrote this code it prints average ,min,max in array but the problem is that the average doesn't print correctly . help plz
Code:
#include <stdio.h>
#include <conio.h>
void func(int A[],int size,int *Max,int *Min,int *Sum,int *Avg)
{
for(int i=0;i<size;i++)
{
if(*Max<A[i])
*Max=A[i];
if(*Min>A[i])
*Min=A[i];
}
for(int i=0;i<size;i++)
{
*Sum=*Sum+A[i];
*Avg=*Sum/10;
}
}
main()
{
int A[10],Max,Min,Sum;
int Avg;
for(int i=0;i<10;i++)
{
printf("plz enter the element # ",i+1);
scanf("%d",&A[i]);
}
func(A,10,&Max,&Min,&Sum,&Avg);
printf("The average of the elements in the array is %d",Avg);
printf("The max is %d and the min is %d",Max,Min);
getch();
}