我也刚学~不过我打出来的怎么是直的一排啊...
public class zhenchu{
public static void main(String args[]){
int num=0;
for(int i=1;i<1000;i++)
if(i%7==0&&i%9==0){
num++;
System.out.println(i+" ");
if(num%8==0)
System.out.println();
}
}
}
public class AAA{
public static void main(String[] args){
int num=0;
for(int i=1;i<=1000;i++){//其实i可以从63开始
if((i%7)==0 && (i%9)==0){
System.out.print(""+i+" ");
num++;
}
if(num==8){
System.out.println();
num=0;
}
}
}
}
public class Excesiss {
public int temp = 0;
public static void main(String args[]) {
Excesiss ex = new Excesiss();
ex.print();
}
public void print() {
for(int i = temp;i < 1000;i++) {
int count = 0;
if(i%7 == 0 && i%9 ==0) {
if(count != 7) {
count ++;
System.out.println(i+"\t");
}else {
System.out.println();
print();
}
}
temp += 1;
}
}
}
public class Calc{
public static void main(String[] args) {
for(int count = 0, i = 0; i <= 1000; i++) {
if(i % (7 * 9) == 0) {
System.out.print(i + "\t");
if(++count % 8 == 0) System.out.println();
}
}
}
}
int num = 0;
for (int i = 0; i < 1000; i++) {
if( i%7 == 0 && i%9 == 0 ){
num++;
System.out.print(i + " ");
if( num %8 ==0){
System.out.println();
}
}
}