为了账号安全,请及时绑定邮箱和手机立即绑定

计算输入数字的总和和平均值,并在 Eclipse 中对数字进行排序

计算输入数字的总和和平均值,并在 Eclipse 中对数字进行排序

长风秋雁 2021-09-29 17:35:53
问题:编写一个程序,读取用户的五个整数。程序将计算并输出以下是关于这五个数字的统计数据:• The sum of all of the positive numbers (greater than zero).• The sum of all of the non-positive numbers (less than or equal to zero).• The sum of all five numbers.• The average of all of the positive numbers (greater than zero).• The average of all of the non-positive numbers (less than or equal to zero).• The average of all five numbers.这是我的代码:package assignment_09_20_2018;import java.util.Scanner ; public class LAB_Assignment_09_20_2018 {    public LAB_Assignment_09_20_2018() {        // TODO Auto-generated constructor stub    public static void main(String[] args) {        // TODO Auto-generated method stub        int length;         Scanner input = new Scanner(System.in) ;        //opens scanner        System.out.println("Enter 5 numbers: ") ;        length = input.nextInt() ;         Int[] numbers = new Int[length]    }} 我班上有人说要使用数组和 for 循环,但我不知道如何使用,请帮忙
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 218 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号