java 打印三角形 - 等腰星

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java 打印三角形 - 等腰星相关的知识,希望对你有一定的参考价值。

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package BASICJAVA;

import java.util.Scanner;

/**
 *
 * @author ABIR
 */
public class Triangle_Isosceles_Star {
    public static void main(String[]args){
        Scanner abir=new Scanner(System.in);
        System.out.println("Enter sample input");
        int x=abir.nextInt();
        System.out.println("sample output");
        int c=0;
        while(c<x){
          int d=0;
          while(d<x-(c+1)){
            System.out.print(" ");
            d++;
          }
          int e=c+c+1;
          int f=0;
          while(f<e){
            System.out.print("*");
            f++;
          }
          System.out.println();
          c++;
        }
        System.out.println("=======================================================");
      }
}

以上是关于java 打印三角形 - 等腰星的主要内容,如果未能解决你的问题,请参考以下文章

java 打印三角形等腰数

java打印等腰杨辉三角

java打印等腰三角形的两种方法!(根据行数,根据底边长度)

java例题_33 等腰输出杨辉三角

打印三角 scala秒杀java

java 用while循环打印n行星号组成的等腰三角形