problem looping and array

hello, i done this program and try to execute it. but it still have error at the third looping. can someone help me fix the error?
and tell me why i have this error ?

thank you.
Last edited on
You must change :
for (int i = 1; i <= 3; i++) // looping 3 times

to
for (int i = 0; i < 3; i++) // looping 3 times
thank you....it goes well..
But what the different? i think its the same equation.
No, they are ALMOST the same. Arrays start at zeroes, so when your loop goes from 1 to 3, you are out of bounds, since your array is s1[0], s1[1] and s1[2].
Topic archived. No new replies allowed.