Program Pola Bintang menggunakan Java
Segitiga siku-siku kanan import java.util.Scanner; public class BintangSikuKanan { public static void main(String args[]) { Scanner db=new Scanner(System.in); System.out.println("Masukkan batas baris: "); int n=db.nextInt(); /*int n=5;*/ for (int i=1;i<=n;i++) { for(int j=1;j<=i;j++) { System.out.print("*"); } System.out.println(); } } } Segitiga siku-siku kiri import java.util.Scanner; public class BintangSikuKiri { public static void main(String []args) { Scanner db=new Scanner(System.in); System.out.println("Masukkan batas baris: "); int n=db.nextInt(); int i,j,k; for( i=1;i<=n;i++) { //spasi for( j=(n-1);j>=i;j--) { System.out.print(" "); } for( k=1;k<=i;k++) { System.out.print("*"); } System.out.println(); } } } Segitiga sama sisi import java.util.Scanner; public class BintangSegitigaSamaSi