问题:编写一个程序,读取用户的五个整数。程序将计算并输出以下是关于这五个数字的统计数据:• 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 循环,但我不知道如何使用,请帮忙
添加回答
举报
0/150
提交
取消