Prime numbers program

后端 未结 14 1504
无人及你
无人及你 2021-01-07 00:27

I\'m currently trying out some questions just to practice my programming skills. ( Not taking it in school or anything yet, self taught ) I came across this problem which re

14条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-07 00:59

    Running your code through a debugger, I've found that it crashes with a floating point exception at "if ((a % c) == 0)". The reason for this is that you haven't initialized anything in num, so you're doing "a % 0".

提交回复
热议问题