#include <iostream>
#include <fstream>
#include <stdlib.h>
using namespace std;
int main()
{
   ifstream inFile;
   inFile.open("sales.txt",ios::in);
   int sales, counter=0;
   float average = 0.0;
   if (!inFile)
	{
		cerr << "some thing wrong during opening file!" << endl;
		exit(1);
	}
	  inFile>>sales;
        cout<<"  "<<sales<<endl;
      while ( !inFile.eof()) {
        average += sales ;
      sales=0;
        counter ++;
     inFile>>sales;
     if(sales!=0)
        cout<<"  "<<sales<<endl;
   }
   inFile.close();
   average /= counter ;
   cout<<"  average = "<<average;
   return 0;
}
