Ποιο είναι το αποτέλεσμα
του ακόλουθου προγράμματος;
#include <stdio.h>
#include <conio.h>
float get_average(float newdata);
main()
{
int i;
float
data[4]={10,20,30,40},average;
for
(i=0;i<4;i++)
{
average=get_average(data[i]);
printf("new_data=%f\tThe current sliding
average is %f\n",data[i],average);
}
}
float get_average(float newdata)
{
static
float total=0.0;
static
int count=0;
count++;
total=total+newdata;
return(total/count);
}