public class ForForTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
StarFor(5,5);
System.out.println("------------");
StarFor_1(5,5);
System.out.println("------------");
Print99(7);
}
public static void StarFor(int x,int y){
for(int i=0;i<x;i++){
for(int j=0;j<i;j++){
System.out.print(" ");
}
for(int k=i;k<y;k++){
System.out.print("*");
}
System.out.println();
}
}
public static void StarFor_1(int x,int y){
for(int i=0;i<x;i++){
for(int j=0;j<y-i-1;j++){
System.out.print(" ");
}
for(int k=x-i-1;k<y;k++){
System.out.print("*");
}
System.out.println();
}
}
public static void Print99(int x){
for(int i=1;i<=x;i++){
for(int j=1;j<=i;j++){
System.out.print(j+"*"+i+"="+j*i+"\t");
}
System.out.println();
}
}
}
|
|