import java.util.Scanner;
class ChengFaKouJue {
public static void main(String[] args) {
while (true) {
System.out.print("请输入一个整数:");
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
print(a);
}
}
public static void print(int a){
for(int i =1;i<=a;i++){
for (int k = 1;k<i;k++){
System.out.print( "\t");
}
for (int j=a+1-i;j>=1;j--){
System.out.print((a+1-i)+"*"+j+"="+(a+1-i)*j+"\t");
}
System.out.println();
}
}
} |
|