You never declared what "counts" is. This code is all over the place. If you going to use a flow chart for the logic, you should make it easy to understand. Than work out the syntax after. The complier doesn't know what counts is. And if you going to declare sum, it might be better to declare it on top before loops logics. You might need to use a true//false logic to know which loop it will pick. You should also maybe put a error message in the for loop so it can help you with bugs if any error. Anyways I don't need to charge you anything. GL my friend, don't get discouraged if it all seems complex, spend more time reading on logic, do some practice programming questions.