Multiple conditions in for statement

前端 未结 4 1537
有刺的猬
有刺的猬 2021-01-28 02:20

I have this code in a function, but when it runs it does a long pause and then it says:

$floating point exception

I am assuming this is due to

4条回答
  •  清酒与你
    2021-01-28 02:49

    You will get into an infinite loop when the if-statement is reached. This will cause the error. You probably wanted to stop the loop if j == 1? Then you had to write

    for (i = 2; (i < number || j!=1); i++)
    

提交回复
热议问题