Segitiga Sama Sisi Mengunakan Java

Posted by Andy Marthin on 9 April 2014 - 1 min read

Segitiga sama sisi mengunkan loop for di java

public class Segitiga{
	public static void main(String[] args) {
		int n = 10;
		for (int i = 1;i<=n ;i++) {
			for (int j = n;j > i ;j-- ) {
				System.out.print(" ");
			}
			for (int k = 1;k <= i ;k++ ) {
				System.out.print("* ");
			}
			System.out.println();
		}
		System.out.println();
	}
}