77.json 1.5 KB
Newer Older
每日一练社区's avatar
test  
每日一练社区 已提交
1
{
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
  "question_id": 7456837,
  "question_title": "按要求求质数",
  "question_content": "求10-100之间个位数为7的质数",
  "difficulty": "简单",
  "answer_id": 53440905,
  "answer_content": "<pre>\n<code>#include &lt;stdio.h&gt;\nint isp(int n)\n{\n    int i;\n    if (n&lt;2)\n        return 0;\n    for (i&#61;2;i*i&lt;&#61;n;&#43;&#43;i)\n    {\n        if (n%i&#61;&#61;0)\n            return 0;\n    }\n    return 1;\n}\nint main()\n{\n    int i&#61;17;\n    while (i&lt;&#61;100)\n    {\n        if (isp(i))\n            printf(&#34;%d  &#34;,i);\n        i&#43;&#61;10;   //只需要验证17,27,37,47,57,67,77,87,97这9个数\n    }\n    printf(&#34;\\n&#34;);  \n    return 0;\n}</code></pre>\n\n<p><img alt=\"\" height=\"135\" src=\"https://img-ask.csdnimg.cn/upload/1624363941556.png\" width=\"547\" /> </p>\n",
  "tag_name": "c语言",
  "cpp": "#include <stdio.h>\nint isp(int n)\n{\n\tint i;\n\tif (n<2)\n\t\treturn 0;\n\tfor (i=2;i*i<=n;++i)\n\t{\n\t\tif (n%i==0)\n\t\t\treturn 0;\n\t}\n\treturn 1;\n}\nint main()\n{\n\tint i=17;\n\twhile (i<=100)\n\t{\n\t\tif (isp(i))\n\t\t\tprintf(\"%d  \",i);\n\t\ti+=10;   \n\t}\n\tprintf(\"\\n\");  \n\treturn 0;\n}",
  "topic_link": "https://bbs.csdn.net/topics/600470167",
  "status": 1,
  "keywords": "质数,数学运算",
  "license": "csdn.net",
  "notebook": {
    "cpp": "https://codechina.csdn.net/csdn/csdn-daily-code/-/jupyter/master/data/notebook/answer/ipynb/cpp/77.ipynb?type=file"
  },
  "notebook_enable": 1,
  "author": "weixin_44563215"
每日一练社区's avatar
test  
每日一练社区 已提交
19
}