java等腰三角形直角三角形九九乘法表 关键代码

    xiaoxiao2022-06-30  108

    <span style="font-size:18px;">等腰三角形: Scanner input = new Scanner(System.in); int row=0; System.out.print("请输入直角三角形的行数:"); int row = input.nextInt(); for (int i = 1; i <= row; i++) { for (int k = 1; k <= row - i; k++) { System.out.print(" "); } for (int j = 1; j <= 2 * i - 1; j++) { System.out.print("*"); } System.out.print("\n") </span> <span style="font-size:18px;"></span>  <span style="font-size:18px;"> 12345直角三角形: Scanner input = new Scanner(System.in); int rows = 0; System.out.println("请输入行数:"); rows = input.nextInt(); for (int i = 1; i <=rows; i++) { for (int k = 1; k<=i; k++) { System.out.print(k); } System.out.print("\n"); }</span> <span style="font-size:18px;"> 九九乘法表: </span> <span style="font-size:18px;"> Scanner input =new Scanner(System.in); int row=9; for(int i=1;i<=row;i++){ for(int k=1;k<=i;k++){ System.out.print(k+"*"+i+"="+k*i+" "); }System.out.print("\n"); }</span>
    转载请注明原文地址: https://ju.6miu.com/read-1126263.html

    最新回复(0)