java实现打印倒直角三角形

来源:互联网 发布:手机淘宝好评能修改吗 编辑:程序博客网 时间:2024/05/17 08:48
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");}}}

0 0
原创粉丝点击