Main 2000 1000 3000 2000 2000
Clay 3000 5000 4000 5000 4000
King 2000 2000 4000 2000 0
* What is a "Company"? Is it all input or just one line?
* What is a "Complex"? A line?
* What is "monthly income"? Given "if any of the months had zero income
", probably one value.
What is in a line then?
Is it one string, "name of Complex", and then N integers that are monthly income?
The N is then number of months.
The example happens to have data for 5 months (for each Complex). You cannot assume in your code that the N is 5.
If you cannot know how much data is coming during this run of the program, then you should either
allocate space for data dynamically, or
process each value as it comes in, without storing the value. In this case the latter should be feasible.
PS. Please reduce the amount of empty lines.