{
"question_id": 7446447, "question_title": "判断是否能组成三角形", "question_content": "<p>根据输入的三角形的三边判断是否能组成三角形,若可以则输出它的周长和三角的类型</p>", "difficulty": "简单", "answer_id": 53425759, "answer_content": "<pre>\n<code class=\"language-cpp\">#include<stdlib.h>\n#include<stdio.h>\nint main ( void )\n{\n\tint num1,num2,num3;\n\tprintf("请输入第一条边:");\n\tscanf("%d",&num1);\n\tprintf("请输入第二条边:");\n\tscanf("%d",&num2);\n\tprintf("请输入第三条边:");\n\tscanf("%d",&num3);\n\tif(num1+num2>num3&&num2+num3>num1&&num1+num3>num2)\n\t{\n\t\tif (num1*num1+num2*num2==num3*num3||num2*num2+num3*num3==num1*num1||num1*num1+num3*num3==num2*num2){\n\t\t\tprintf ( "%d、%d和%d可以组成直角三角形。\\n " ,num1,num2,num3);\n\t\t\tprintf ("三角形周长:%d\\n",num1+num2+num3);\n\t\t}\n\t\t\n\telse if (num1*num1+num2*num2<num3*num3||num2*num2+num3*num3<num1*num1||num1*num1+num3*num3<num2*num2)\n\t\t\t{\n\t\t\t\tprintf ("%d、%d和%d可以组成锐角三角形。\\n" ,num1,num2,num3);\n\t\t\t\tprintf ("三角形周长:%d\\n",num1+num2+num3);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tprintf ("%d、%d和%d可以组成钝角三角形\\n" ,num1,num2,num3);\n\t\t\t\tprintf ("三角形周长:%d\\n",num1+num2+num3);\n\t\t\t}\n\t}\n\telse\n\t\tprintf("%d, %d和%d不能组成三角形。\\n",num1,num2,num3);\n\tsystem("PAUSE");\n\treturn 0;\n}</code></pre>\n\n<p> </p>\n", "tag_name": "c++", "cpp": "#include<stdlib.h>\n#include<stdio.h>\nint main(void)\n{\n\tint num1,num2,num3;\n\tprintf(\"请输入第一条边:\");\n\tscanf(\"%d\",&num1);\n\tprintf(\"请输入第二条边:\");\n\tscanf(\"%d\",&num2);\n\tprintf(\"请输入第三条边:\");\n\tscanf(\"%d\",&num3);\n\tif(num1+num2>num3&&num2+num3>num1&&num1+num3>num2)\n\t{\n\t\tif (num1*num1+num2*num2==num3*num3||num2*num2+num3*num3==num1*num1||num1*num1+num3*num3==num2*num2){\n\t\t\tprintf ( \"%d、%d和%d可以组成直角三角形。\\n \" ,num1,num2,num3);\n\t\t\tprintf (\"三角形周长:%d\\n\",num1+num2+num3);\n\t\t}\n\telse if (num1*num1+num2*num2<num3*num3||num2*num2+num3*num3<num1*num1||num1*num1+num3*num3<num2*num2)\n\t\t\t{\n\t\t\t\tprintf (\"%d、%d和%d可以组成锐角三角形。\\n\" ,num1,num2,num3);\n\t\t\t\tprintf (\"三角形周长:%d\\n\",num1+num2+num3);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tprintf (\"%d、%d和%d可以组成钝角三角形\\n\" ,num1,num2,num3);\n\t\t\t\tprintf (\"三角形周长:%d\\n\",num1+num2+num3);\n\t\t\t}\n\t}\n\telse\n\t\tprintf(\"%d, %d和%d不能组成三角形。\\n\",num1,num2,num3);\n\tsystem(\"PAUSE\");\n\treturn 0;\n}", "topic_link": "https://bbs.csdn.net/topics/600469958", "status": 1, "keywords": "数学,三角形", "license": "csdn.net", "notebook": { "cpp": "https://codechina.csdn.net/csdn/csdn-daily-code/-/jupyter/master/data/notebook/answer/ipynb/cpp/100.ipynb?type=file" }, "notebook_enable": 1, "author": "weixin_45750218"
}