public static void main(String[] args) {
int sum = 0;
int count = 0;
System.out.println("1-100之间不能被7整除的数为:");
for (int i = 1; i < 101; i++) {
if( i % 7 != 0){
sum += i ;
count ++;
System.out.print(i+"\t");
if(count == 4){
System.out.println();
count = 0;
}
}
}
System.out.println("\n数据之和为:"+sum);
}
public static void main(String[] args) {
System.out.println("1-100之间不能被7整除的数为:");
List
int count = 0;
for(int i=1;i<=100;i++){
if( i%7 != 0){
a.add(i);
count += i;
}
if(a.size()==4){
for(int j=0;j<4;j++){
if(j!=0){
System.out.print(" "+a.get(j));
}else{
System.out.print(a.get(j));
}
}
System.out.print("\n");
a.clear();
continue;
}
}
System.out.println("总和:"+count);
}