PBO-P Membuat Pola Segitiga Bintang Menggunakan Java

Berikut Source Code :
/*
 * 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 latihan1;

/**
 *
 * @author Bintang Amri Putra
 * 21/03/2022
 */
public class Latihan1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
      int n=5;
      int a;
      for(a=0; a<=n; a++){
          for(int z=n; z>=a; z--){
              System.out.print(" ");
          }
          for(int x=0; x<=a; x++){
              System.out.print("* ");
          }
      
        System.out.println();
       }
    }
}

Tidak ada komentar:

Posting Komentar