{ "type": "code_options", "author": "csdn.net", "source": "solution.md", "exercise_id": "103703df56b7460dbd9c5dde44d37af0", "keywords": "算法高阶,计算几何学,算法问题选编", "title": "计算所有4位正整数中同时能被13和20整除的数的和", "desc": [ { "content": "\n
计算所有4位正整数中同时能被13和20整除的数的和, 并同时做到如下显示:\n①显示这些数:\n②显示这些数的个数:\n③显示这些数的和。
", "language": "markdown" } ], "answer": [ { "content": "", "language": "cpp" } ], "prepared": [ [ { "content": "", "language": "cpp" } ], [ { "content": "", "language": "cpp" } ], [ { "content": "", "language": "cpp" } ] ], "template": { "content": "#include \"stdio.h\"\nint main()\n{\n\tint i = 1000;\n\tint count = 0;\n\tint sum = 0;\n\tprintf(\"所有4位正整数中同时能被13和20整除的数:\\n\");\n\tfor(i = 1000;i<10000;i++)\n\t{\n\t\tif(i % 13 == 0 && i % 20 == 0)\n\t\t{\n\t\t\tcount++;\n\t\t\tsum = sum + i;\n\t\t\tprintf(\"%d、\",i);\n\t\t}\n\t}\n\tprintf(\"\\n这些数一共有%d个\\n\",count);\n\tprintf(\"这些数的和是:%d\\n\",sum);\n}", "language": "cpp" }, "node_id": "dailycode-d83f9085634b418e80229a2b5a9cb63c", "license": "csdn.net", "created_at": 1637894160, "topic_link": "https://bbs.csdn.net/topics/600469942" }