On line 28 you update sum when you should be updating sum1, I think. If you wan the sum of each row you will have to reset sum1 before you start on a new row.
The problem description asks for the median and not the sum.
right but before i can get to median i need sum of all positive numbers no?
Note that median is not necessary the same as the average. I don't think the sum will help you find the median.
Last edited on