If statements in for loops

The problem seems to be the for loop. Your program accepts a value for a as an input, but then as soon as the loop begins, it resets the value of a to 0 (for (a = 0;… Therefore it’s looping 10 times, and on each loop a will have a different value, starting from … Read more