{ "question_id": 702203, "question_title": "检查一个3位数是否是水仙花数", "question_content": "检查一个3位数是否是水仙花数。\n输入:一个数字,比如 371,输出:x是水仙花数,\n如果不是,则输出:x不是水仙花数。\n注:x为输入的数字", "difficulty": "简单", "answer_id": 592515, "answer_content": "\n\n```\n #include \nusing namespace std;\nint main()\n{\n\tint a, b, c, y, n = 0;\n\tcout << \"请输入三位数字:\" << endl;\n\tcin >> n;\n\n\ta = n % 1000 / 100; //求第一位数 \n\tb = n % 100 / 10; //求第二位数\n\tc = n % 10 / 1; //求第三位数 \n\ty = a*a*a + b*b*b + c*c*c;\n\tif (y == n) cout << n << \"是水仙花数\" << endl;\n\telse cout << n << \"不是水仙花数\" << endl;\n\t\n\n\tsystem(\"pause\");\n\treturn 0;\n}\n```\n\n", "tag_name": "c++", "cpp": "#include \nusing namespace std;\nint main()\n{\n\tint a, b, c, y, n = 0;\n\tcout << \"请输入三位数字:\" << endl;\n\tcin >> n;\n\ta = n % 1000 / 100; \n\tb = n % 100 / 10;\t\n\tc = n % 10 / 1;\t \n\ty = a*a*a + b*b*b + c*c*c;\n\tif (y == n) cout << n << \"是水仙花数\" << endl;\n\telse cout << n << \"不是水仙花数\" << endl;\n\tsystem(\"pause\");\n\treturn 0;\n}", "topic_link": "https://bbs.csdn.net/topics/600469841", "status": 1, "keywords": "数学,算法", "license": "csdn.net", "notebook": { "cpp": "https://codechina.csdn.net/csdn/csdn-daily-code/-/jupyter/master/data/notebook/answer/ipynb/cpp/0.ipynb?type=file" }, "notebook_enable": 1 }