{
"question_id": 7456837, "question_title": "按要求求质数", "question_content": "求10-100之间个位数为7的质数", "difficulty": "简单", "answer_id": 53440905, "answer_content": "<pre>\n<code>#include <stdio.h>\nint isp(int n)\n{\n int i;\n if (n<2)\n return 0;\n for (i=2;i*i<=n;++i)\n {\n if (n%i==0)\n return 0;\n }\n return 1;\n}\nint main()\n{\n int i=17;\n while (i<=100)\n {\n if (isp(i))\n printf("%d ",i);\n i+=10; //只需要验证17,27,37,47,57,67,77,87,97这9个数\n }\n printf("\\n"); \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"
}