score:14

i am not sure why you are messing it up by looping first and writing a query again in the loop. do it either with a foreach loop or a linq query like this:-

int result = items.sum(x => x.cost);

it will give you 210 as output.


Related Query

More Query from same tag