Prime numbers program

后端 未结 14 1592
无人及你
无人及你 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:13

    From what I know, in C/C++ int is a 16bit type so you cannot fit 1 million in it (limit is 2^16=32k). Try and declare "a" as long

    I think the C standard says that int is at least as large as short and at most as large as long.

    In practice int is 4 bytes, so it can hold numbers between -2^31 and 2^31-1.

提交回复
热议问题