Prime numbers program

后端 未结 14 1511
无人及你
无人及你 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 01:06

    For one, you'd have less code (which is always a good thing!) if you didn't have special cases for 3, 5 and 7.

    Also, you can avoid the special case for 2 if you just set num[b] = 2 and only test for divisibility by things in your array.

提交回复
热议问题