{
  "question_id": 7458543,
  "question_title": "输入一个数查找比它小的元素",
  "question_content": "<p>一个整型数组有10元素&#xff0c;请先给这10个元素赋值&#xff0c;然后随便输入一个数&#xff0c;最后输出数组中比这个数小的所有元素&#xff0c;每个数用空格隔开&#xff0c;如果没有找到&#xff0c;则输出not find。<br />\n </p>\n<p style=\"text-align:center\"><img alt=\"\" src=\"https://img-ask.csdnimg.cn/upload/1624519041254.jpg\" />\n </p>",
  "difficulty": "中等",
  "answer_id": 53443165,
  "answer_content": "<p>代码如下&#xff1a;</p>\n\n<pre>\n<code>#include &lt;stdio.h&gt;\nint main()\n{\n\tint a[10],i,n;\n\tint isfind &#61; 0;\n\tprintf(&#34;please set array values:&#34;);\n\tfor(i&#61;0;i&lt;10;i&#43;&#43;)\n\t\tscanf(&#34;%d&#34;,&amp;a[i]);\n\n\tprintf(&#34;please enter one num:&#34;);\n\tscanf(&#34;%d&#34;,&amp;n);\n\tfor (i&#61;0;i&lt;10;i&#43;&#43;)\n\t{\n\t\tif(a[i] &lt; n)\n\t\t{\n\t\t\tisfind &#61; 1;\n\t\t\tprintf(&#34;%d &#34;,a[i]);\n\t\t}\n\t}\n\t\n\tif(isfind)\n\t\tprintf(&#34;\\n&#34;);\n\telse\n\t\tprintf(&#34;not find\\n&#34;);\n\t\n\t\n\treturn 0;\n}</code></pre>\n",
  "tag_name": "c语言",
  "cpp": "#include <stdio.h>\nint main()\n{\n\tint a[10],i,n;\n\tint isfind = 0;\n\tprintf(\"please set array values:\");\n\tfor(i=0;i<10;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tprintf(\"please enter one num:\");\n\tscanf(\"%d\",&n);\n\tfor (i=0;i<10;i++)\n\t{\n\t\tif(a[i] < n)\n\t\t{\n\t\t\tisfind = 1;\n\t\t\tprintf(\"%d \",a[i]);\n\t\t}\n\t}\n\tif(isfind)\n\t\tprintf(\"\\n\");\n\telse\n\t\tprintf(\"not find\\n\");\n\treturn 0;\n}",
  "topic_link": "https://bbs.csdn.net/topics/600470172",
  "status": 1,
  "keywords": "算法高阶,数论算法,元素的幂,算法问题选编",
  "license": "csdn.net",
  "notebook": {
    "cpp": "https://codechina.csdn.net/csdn/csdn-daily-code/-/jupyter/master/data/notebook/answer/ipynb/cpp/95.ipynb?type=file"
  },
  "notebook_enable": 1,
  "author": "qq_42826033"
}