package com.company;
import java.util.Scanner;
public class demo08 {
public static void main(String[] args) {
/**
* //倒三角
* for (int i=1;i<=5;i++){
* for (int j = 5; j >=i ; j--) {
* System.out.print("*");
* }
* System.out.println();
* }
*/
//等腰三角形
Scanner scanner=new Scanner(
System.in);
System.out.println("请输入等腰三角形的行数");
int hangshu=scanner.nextInt();
for (int i=1;i<=hangshu;i++) {//控制行数
for (int j =0;j<5-i; j++) {//一行中"#"个数
System.out.print("#");
}
for (int k =0; k <2*i-1 ; k++) {//一行中"*"的个数
System.out.print("*");
}
System.out.println();
}
}
}
package com.company;
import java.util.Scanner;
public class demo08 {
public static void main(String[] args) {
/**
* //倒三角
* for (int i=1;i<=5;i++){
* for (int j = 5; j >=i ; j--) {
* System.out.print("*");
* }
* System.out.println();
* }
*/
//等腰三角形
Scanner scanner=new Scanner(
System.in);
System.out.println("请输入等腰三角形的行数");
int hangshu=scanner.nextInt();
for (int i=1;i<=hangshu;i++) {//控制行数
for (int j =0;j<5-i; j++) {//一行中"#"个数
System.out.print("#");
}
for (int k =0; k <2*i-1 ; k++) {//一行中"*"的个数
System.out.print("*");
}
System.out.println();
}
}
}
package com.company;
import java.util.Scanner;
public class demo08 {
public static void main(String[] args) {
/**
* //倒三角
* for (int i=1;i<=5;i++){
* for (int j = 5; j >=i ; j--) {
* System.out.print("*");
* }
* System.out.println();
* }
*/
//等腰三角形
Scanner scanner=new Scanner(
System.in);
System.out.println("请输入等腰三角形的行数");
int hangshu=scanner.nextInt();
for (int i=1;i<=hangshu;i++) {//控制行数
for (int j =0;j<5-i; j++) {//一行中"#"个数
System.out.print("#");
}
for (int k =0; k <2*i-1 ; k++) {//一行中"*"的个数
System.out.print("*");
}
System.out.println();
}
}
}