Hi,
I have a file containing the frequency's of an element sorted in ascending order. The file looks something like this:
#Element Frequency
1 1
2 1
3 1
4 1
5 1
6 1
7 2
8 10
9 15
10 20
What I want is to calculate and print the cumulative frequency (adding the current frequency to the sum of the previous frequency's) with the existing data. So the
output file should look like this:
#Element Frequency Cumulative Frequency
1 1 1
2 1 2
3 1 3
4 1 4
5 1 5
6 1 6
7 2 8
8 10 18
9 15 33
10 20 53
Thanks !!