I don't know how to calculate the average. I am getting the output I am expecting, except for the average in which I want to enter in a column beside all my other info. Thanks so much to whoever can look at it for me.
using System;
using System.IO;
public static class Program
{
static void Main()
{
string file="marks2D.txt";
string outfile="average.csv";
StreamReader sr= new StreamReader(file);
StreamWriter outstream= new StreamWriter(outfile);
double[,] temp=new double[5,6];
int num=0;
double ave=0;
for(int i=0; i<temp.GetLength(0); i++)
{
double sum=0;
string line=sr.ReadLine();
for(int j=0; j<temp.GetLength(1); j++)
{
double m=double.Parse(line);
temp[i,j]=m;
sum+=m;
ave = sum/5;
//temp[i,j]=line;
outstream.WriteLine(ave);
outstream.WriteLine("{0,1}", temp[i,j]);
}
}
outstream.WriteLine();
Console.WriteLine();
sr.Close();
outstream.Close();
}
}