gpt4 book ai didi

java显示范围内的输入

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:09:44 26 4
gpt4 key购买 nike

<分区>

您好,下面的程序出了什么问题?因为我希望它显示 1-10, 11-20,21-30 ... 191-200 范围内的用户输入整数值?

public class Program
{
/**
* This is the main entry point for the application
*/
public static void main(String args[])
{
int a[] = new int[100];
int i = 0;
Scanner in = new Scanner(System.in);
while(i<100)
{
System.out.println("Enter a int");
a[i] = in.nextInt();
displayStatistics(a[i]);


}

}

public static void displayStatistics(integer[] a[i])
{
if(a[i]>=1 && a[i]<=100)
{
i++;
System.out.println(); ----> need to display in range 1-10, 11-20,21-30 ... 191-200
} else {
System.out.println("Integer not in range of 1-200");
}
}
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com