Skip to main content

Practice ยท 4 of 4

Sum a comma list

CHALLENGE
Difficulty: beginner+25 XP

Implement static int SumList(string csv) โ€” input like "3,4,10"; split on commas, parse each piece, return the sum. Any unparseable piece makes the whole input invalid: return -1.

Back to lesson: Practice: Parse and validate