Hi everyone! I need to write program that will find the average of 20 element array and also display the number of each number in the array occurs.
I have sorted average number but straggle with "number of occurrences". Please help!!!!
#include<stdio.h>
#include<math.h>
main()
{
float avg,sum=0;
int i,j;
int numbers[20]; /*array declaration*/
for(i=0;i<20;i++)
{
printf("\nEnter number: ");
scanf("%d",&numbers[i]); /*store data in array*/
}
for(i=0;i<20;i++)
sum=sum+numbers[i]; /*read data from array*/
avg = sum/20;
printf("\n\nAverage number of this 20 numbers is %5.2f\n\n\n",avg);