i think what i was trying to do was take the contents in the array and add them together then / by 5 to get the average.
Code:
for ( x=0; x<5; x++ )
Array[x]= Array[x]+ Array[x]/5;
im trying to learn c so i am going to make alot of mistakes! and i did think it out before i coded it. but it didnt help =/
it works:
Code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int x,c;
float average;
int Array[5]={
99,105,67,23,79
};
for ( x = 0; x < 5; x++ )
average += Array[x];
printf("average is %.2f\n",average/5);
getchar();
return 0;
}
thanks for all your help.