Tugas Pendahuluan 1 (TP1) Prak OOP

Tugas Pendahuluan 1 Prak OOP


/*
NRP= 0974016
NAMA= Senu Dwi Aussie
TGL.PEMBUATAN= 29-Agustus-2009
DESKRIPSI FILE= Tugas Pendahuluan 1 (TP1) Membuat Piramida
*/

public class Piramid{

	public static void main(String args[]){

		System.out.println("Piramid 1");
		System.out.println("*********");

		for (int i=1;i<=5;i++){

				for (int j=1;j=1;i--){

				for (int j=1;j<=i;j++)System.out.print(j);
				System.out.println();

			}

		System.out.println("\nPiramid 3");
		System.out.println("*********");
		for (int i=1;i=i;j--)System.out.print(j);
				System.out.println();

			}

		System.out.println("\nPiramid 4");
		System.out.println("*********");

		for(int a=5;a>=1;a--){
    		for (int h=1;h<=a-1;h++) System.out.print(" ");
    			for(int b=a;b<=5;b++)System.out.print(b);
    	System.out.println();
    	}

	}

	}

compile n run, u'll see something like this


Piramid 1
*********
1
12
123
1234
12345

Piramid 2
*********
12345
1234
123
12
1

Piramid 3
*********
54321
5432
543
54
5

Piramid 4
*********
    5
   45
  345
 2345
12345

Tinggalkan Balasan

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Ubah )

Twitter picture

You are commenting using your Twitter account. Log Out / Ubah )

Facebook photo

You are commenting using your Facebook account. Log Out / Ubah )

Connecting to %s