{ "type": "code_options", "author": "csdn.net", "source": "solution.md", "exercise_id": "55656322f3944cb79f0d37a097b877bf", "keywords": "算法初阶,最小值和最大值,排序和顺序统计量,中位数和顺序统计量", "title": "求输入数字的平均值、最大值", "desc": [ { "content": "\n

输入若干个数,设输入的第一个数n为后面要输入的数的个数,求平均值及最大值,并在屏幕输出来

", "language": "markdown" } ], "answer": [ { "content": "", "language": "java" } ], "prepared": [ [ { "content": "", "language": "java" } ], [ { "content": "", "language": "java" } ], [ { "content": "", "language": "java" } ] ], "template": { "content": "import java.util.Scanner;\npublic class Test{\n\tpublic static void main(String[] args) {\n\t\tScanner in=new Scanner(System.in);\n\t\tSystem.out.println(\"输入n:\");\n\t\tint n=in.nextInt();\n\t\tint temp,max=0,sum=0;\n\t\tfor(int i=0;imax){\n\t\t\t\tmax=temp;\n\t\t\t}\n\t\t\tsum+=temp;\n\t\t}\n\t\tSystem.out.println(\"最大值为:\"+max+\",平均值为:\"+sum*1.0/n);\n\t}\n}", "language": "java" }, "node_id": "dailycode-9c270d6326d3421c974562ddce0e3a56", "license": "csdn.net", "created_at": 1637894161, "topic_link": "https://bbs.csdn.net/topics/600469973" }