package September;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class First {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
List<Integer> c = new ArrayList<Integer>();
while(true) {
System.out.println("请输入"+(c.size()+1)+"个元素");
int num = scan.nextInt();
if(num>0&&num%3==0) {
c.add(num);
}
if(c.size()==3) {
break;
}
}
for(int i=0;i<c.size();i++) {
System.out.print("需求的数是:"+c.get(i));
}
}
}
919-1
最新推荐文章于 2024-09-21 06:45:00 发布