1 Attachment(s)
How can I calculate average per user ID
I am new to C programming and I have to print content from a file with an average already calculated. I will set the file here to show you how it is displayed. Attachment 16537
I want to calculate the average per line of the second last values (23, 45, 300, ....). I know that there are not many users to get a proper value but what can I do to let the program know that I only want to divide that value/values for the correspondent ID ?
Code:
0001; 12-07-2022; Marcha; 23; 2km
0003; 14-02-2022; Corrida; 45; 4km
0002; 23-05-2022; Btt; 300; 40km
0001; 10-09-2022; Natacao; 30; 250m
0004; 08-03-2022; Marcha; 45; 5km
0005; 29-06-2022; Escalada; 50; 2km
0006; 15-10-2022; Marcha; 35, 3km