java 已在方法 main(String[])中定义了变量 b
importjava.util.*;classyxsl{publicstaticvoidmain(String[]args){Scannerkb=newScanner(S...
import java.util.*;
class yxsl{
public static void main(String[] args){
Scanner kb = new Scanner(System.in);
int n,a,b;
System.out.print("输入共有多少个数:");
n = kb.nextInt();
int []b = new int[2*n];
for(a = 0;a<=b.length;a += 2){
b[a] = kb.nextInt();
}
System.out.print("输入一个数:");
b = kb.nextInt();
for(a = 0;a<=b.length;a +=2){
if(b>=b[a]&&b<=b[a+2]){
b[a+1] = b;
}
}
for(a = 0;a<=b.length;a++){
System.our.print(b[a]+" ");
}
}
} 展开
class yxsl{
public static void main(String[] args){
Scanner kb = new Scanner(System.in);
int n,a,b;
System.out.print("输入共有多少个数:");
n = kb.nextInt();
int []b = new int[2*n];
for(a = 0;a<=b.length;a += 2){
b[a] = kb.nextInt();
}
System.out.print("输入一个数:");
b = kb.nextInt();
for(a = 0;a<=b.length;a +=2){
if(b>=b[a]&&b<=b[a+2]){
b[a+1] = b;
}
}
for(a = 0;a<=b.length;a++){
System.our.print(b[a]+" ");
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询