Fortran: read data from two files , calculate and write in specified format


haris3384
09-08-2012, 03:54 AM
Hi

i have one file (file-1) containing following data

1 2.01E5
2 2.15E5
3 2.18E5
4 2.06E5
5 2.21E5
6 2.35E5

and other file (file-2) containing data

8 2 1 2 3 4
9 2 1 3 5 6
10 3 2 3 4 6
11 5 1 2 4 5

using data from these two files i want to write third file containing

8,P2,AVG(1,2,3,4)
9,P2,AVG(1,3,5,6)
10,P3,AVG(2,3,4,6)
11,P5,AVG(1,2,4,5)

where AVG(1,2,3,4) is the ((2.01E5+2.15E5+2.18E5+2.06E5)/4)

kindly guide me how to proceede and which method to adopt

haris3384
09-10-2012, 08:06 AM
need kind guidance to solve this probelm