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 :
Jadilah yang pertama mengomentari
Post a Comment