java实现打印倒直角三角形

package cn.jbit.nestedloops;
import java.util.Scanner;
/**
 * 输入行数打印倒直角三角形
 */
public class InvertRTriAngle {
	public static void main(String[] args) {
		int rows = 0;	//三角形行数
		System.out.print("请输入直角三角形的行数:");
		Scanner input = new Scanner(System.in);
		rows = input.nextInt();
		
		//打印倒直角三角形
		for(int i = 1; i <= rows; i++){
			for(int j = 1; j <= rows+1-i; j++){
				System.out.print("*");
			}
			System.out.print("\n");
		}
	}
}

posted @ 2016-11-04 23:16  穆雄雄  阅读(2190)  评论(0编辑  收藏  举报