打印*

package Num1;
public class Main {
public void Test(int n){
System.out.println("你输入的三角形如图");
for(int i = 0;i < n;i++){
for(int j = 0;j < n-1-i;j++){
System.out.print("");
}
for(int k = 0;k<=i;k++){
System.out.print("*");
}
//每遍历一次换行
System.out.println("");
}
}


public static void main(String[] args) {
Main n = new Main(); //类名 方法名 = new 类名();
n.Test(7); //方法名.函数名


}

}

 

posted on 2018-03-29 20:37  黄志平  阅读(119)  评论(0编辑  收藏  举报

导航