打印等腰三角形

//打印等腰三角形
import java.util.Scanner;
public class Exam02{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		System.out.println("input row number");
		int num = sc.nextInt();
		for(int i = 0;i < num;i++){
			for(int j = num -i-1;j >= 0;j--)
				System.out.print(" ");
			for(int k = 0;k<=i;k++)
				System.out.print("* ");
			System.out.println();
		}
	}
}

你可能感兴趣的:(java)