#include<stdio.h>

float running_average(float a);

void main()
{

  float a;
  char ch;

  do
    {
      printf("\n Enter number: ");

      scanf("%f", &a);

      printf("\n Running average so far: %f", running_average(a));

      printf("\n Enter more numbers <y/n>?"); 

      scanf("%c%c", &ch, &ch);
    }while(ch!='n');

}

float running_average(float a)
{
  static float total=0; /* Initializations */
  static int count=0; /* executed only the first time the function is called */

  total=total+a;
  count++;

  return total/count;

}

