accept input
i=1,sum = 0;
while sum
sum = 0;
FOR i =1 and i <= sum
sum = sum +i
i++
END FOR
display (sum)
I used 10 to test, the sum is supposed to stop at 15 because:1+2+3+4+5 = 15 but I got 17 I dont knw what im missing plz help
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Sep 2, 2011, 4:12 PM
Lalit MPosted Sep 2, 2011, 12:39 AM
i=0,sum = 0;
while sum
sum = 0;
FOR i =0 and i <= sum
sum = sum +i
i++
END FOR
display (sum)