So i have this program and i can't think of how is it possible to count average and then write minutes and seconds separately. the numbers go like this and i have them in separate arrays. any help is appreciated
4 32
4 52
3 30
3 23
2 41
2 49
3 28
4 33
3 22
i tried with this code i get 33minutes 10seconds but i still have to divide by 9. what can i do else to write them separately again?
1 2 3 4 5 6 7 8 9 10 11
for (int i =0;i<n;i++)
{
vid = D[i].m + vid;
vids = D[i].s + vids;
if (vids >=60)
{
vids = vids - 60;
vid = vid + 1;
}
}
One way would be to
-- convert minutes and seconds to seconds
-- add up the seconds
-- find the average seconds
-- convert average seconds back to minutes and seconds
So if you have a total of 33 minutes and 10 seconds
-- total seconds is 60 * 33 + 10
-- average seconds is total seconds / number of items
-- converting back to minutes and seconds....
---- minutes is average seconds / 60
---- seconds is average seconds % 60