int[] i = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; 根据查询下来的数值a来动态生成如果a=2 int[] i = {1,2};如果a=5int[] i = {1,2,3,4,5};
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 15:57:30
int[]i={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};根据查询下来的数值a来动态生成如果a=2int[]i={1,2};如果a=5int[]
int[] i = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; 根据查询下来的数值a来动态生成如果a=2 int[] i = {1,2};如果a=5int[] i = {1,2,3,4,5};
int[] i = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; 根据查询下来的数值a来动态生成
如果a=2
int[] i = {1,2};
如果a=5
int[] i = {1,2,3,4,5};
int[] i = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; 根据查询下来的数值a来动态生成如果a=2 int[] i = {1,2};如果a=5int[] i = {1,2,3,4,5};
下面的程序根据输入的a值动态生成int[] i ,当a=2时,int[] i = {1,2};当a=5时,int[] i = {1,2,3,4,5};
完整的程序如下:
import java.util.Scanner;
public class L {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.print("请输入a的值:");
int a=sc.nextInt();
int[]i=new int[a];
for(int j=0;j