• 集合ArrayList习题练一练——分数


    namespace 集合习题练一练
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("请输入你们班的人数:");
                int n = Convert.ToInt32(Console.ReadLine());
                ArrayList al = new ArrayList();
                for (int i = 0; i < n; i++)
                {
                    Console.WriteLine("第"+(i+1)+"个同学的成绩为:");
                    al.Add(Convert.ToInt32(Console.ReadLine()));
                }
                for (int i = 0; i < al.Count; i++)
                {
                    Console.WriteLine("同学们的成绩依次为"+al[i]+"分");
                }
                double sum = 0;

                for (int i = 0; i < n; i++)
                {
                    sum = sum + Convert.ToInt32(al[i]);
                }
                Console.WriteLine("总分为"+sum+"分");
                al.Sort();
                for (int i = 0; i < al.Count; i++)
                {
                    Console.WriteLine("同学们的成绩按照一定顺序排列为" + al[i] + "分");
                }
                double ave = 0;
                ave = (sum - Convert.ToInt32(al[0]) - Convert.ToInt32(al[4])) / (al.Count-2);
                Console.WriteLine("你们班的平均分为"+ave+"分");


                Console.ReadLine();
            }
        }
    }

  • 相关阅读:
    Hadoop集群时间同步
    Hadoop学习笔记
    分布式系统搭建
    ubuntu主机名修改
    自定义MapReduce中数据类型
    MapReduce执行流程及程序编写
    YARN框架详解
    Maven下从HDFS文件系统读取文件内容
    Maven搭建Hadoop开发环境
    hdfs文件系统架构详解
  • 原文地址:https://www.cnblogs.com/lk-kk/p/4404105.html
Copyright © 2020-2023  润新知