Are You A Prime Number

后端 未结 11 2219
甜味超标
甜味超标 2021-02-10 07:39

I\'ve been interested in the problem of finding a better prime number recognizer for years. I realize this is a huge area of academic research and study - my interest in this i

11条回答
  •  梦如初夏
    2021-02-10 08:03

    can you suggest an improvement

    Here you go ... not for the algorithm, but for the program itself :)

    • If you aren't going to use argc and argv, get rid of them
    • What if I input "fortytwo"? Compare scanf() == 1, not != EOF
    • No need to cast the value of sqrt()
    • returnValue is not needed, you can return a constant: return 0;
    • Instead of having all of the functionality inside the main() function, separate your program in as many functions as you can think of.

提交回复
热议问题