• Pada Algoritma pencarian banyak yang bisa kita temukan atau gunakan. Ada Merge Sort, Quick Sort, Bubble Sort, dan...
  • Pada dasarnya algoritma searching banyak kita jumpai. Apalagi hanya untuk mencari nilai minimum dan nilai maximum...
  • Kalian pasti sudah tahu apa itu Deret Fibonacci, ya benar. (Padahal gak jawab). Tetapi pada pembahasan kali ini kita akan membuar program...
  • Metoda Pencarian Biner ( Binary Search) hanya bisa diterapkan jika data array sudah terurut. Pengurutan Array bisa menggunakan jenis sorting ...
  • Salah satu contoh tipe algoritma brute force lainnya adalah linear search (pencarian berurutan), Dikatakan demikian karena algoritma ini menggunakan ...

Tuesday, May 3, 2011

Jeliot version : Make a Pyramid Star with Jeliot (Menbuat Piramida Bintang dengan Jeliot)


Sometimes - sometimes at the university each began learning the looping problem (loop) we will see a task to create a pyramid of stars. Therefore I will discuss the issue and help solve it.
To create a pyramid of stars we have to use nested loops. Nested iteration loops is contained in the loop. The loop is suitable for making this pyramid is using for loop. Why choose for loop? Because of this loop for sure. We will repeat how many times can be determined easily.
How does the writing program ?
Here I use the compiler Jeliot, so that the manufacturing process can be seen easily. So it can easily to be understood. First we create a loop to limit / line. After that we created also in the loop iteration space in order to print can bitang sebada middle. The second we live looping to create a star print.
Let not this footage dizziness program :
    // to determine the line
for (baris=1;baris<=tinggi;baris ++){
                 //print the space
                 for (i=1;i<=tinggi-baris;i++){
       System.out.print(" ");
       }
                 //star print
                 for (j=1;j<2*baris;j++){
       System.out.print("*");
       }
System.out.println();
}

After dbuat program and will run resulting in output like the following :

For program details can be downloaded here. Hopefully helpful friend. Do not forget to comment!

Jadilah yang pertama mengomentari

Post a Comment

Tutorial Algorithm and Programming ©Template Blogger Green by Dicas Blogger.

To Up