package com.imooc.array;
public class ArrayDemo2 {
public static void main(String[] args) {
//定義一個整型數組,並初始化
int[] a=new int[15];
//循環遍歷數組,找出能被3整除的元素並打印輸出
for(int i=0;i<15;i++){
a[i]=i+1;
//System.out.print(a[i]+" ");
}
System.out.println("能被3整除的數組元素為:");
for(int i=5;i<a.length;i++){
if(a[i]%3==0){
if(a[i]/3!=3)
System.out.println(a[i]+" ");
}
}
}
}
