solution.json 1.3 KB
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "69471807c64a48d4a531c75fc5a474ef",
  "keywords": "约分,数学运算",
  "title": "约分",
  "desc": [
    {
      "content": "\n编写程序,要求用户输入一个分数,然后将其约分为最简式。如:\n输入一个分数:8/12\n最简分式:2/3",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "cpp"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ]
  ],
  "template": {
    "content": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint a,b,x,y,c;\n\tprintf(\"输入一个分式:\");\n\tscanf(\"%d/%d\",&a,&b);\n\tif(a<b)\n\t{\n\t\tx=b;y=a;\n\t}\n\telse\n\t{\n\t\tx=a;y=b;\n\t}\n\tc=x%y;\n\twhile(c)\n\t{\n\t\tx=y;\n\t\ty=c;\n\t\tc=x%y;\n\t}\n\tif(b/y!=1)\n\t\tprintf(\"最简分式为:%d/%d\",a/y,b/y);\n\telse\n\t\tprintf(\"最简分式为:%d\",a/y);\n\treturn 0;\n}",
    "language": "cpp"
  },
  "node_id": "dailycode-a91ab2d4ae12479088f6fe0653c5f877",
  "license": "csdn.net",
  "created_at": 1637894158,
  "topic_link": "https://bbs.csdn.net/topics/600469845"
}