Buat Program Intan !

*
* * *
* * * * *
* * *
*

PROGRAM Intan
{Untuk mencetak intan dengan jari-jari = N}

DEKLARASI
Baris, Kolom, N : Integer

ALGORITMA:
Read (N)
Baris <- 1="" span="">
While Baris ≤ N do
Write ('*' : N + 1 - Baris)
Kolom <- 2="" span="">
While Kolom <- -="" 1="" baris="" do="" span="">
Write ('*')
Kolom <- kolom="" span="">
Endwhile
Writeln ( )
Baris <- baris="" span="">
Endwhile
Baris <- baris-2="" span="">
While Baris ≥ 1
Write ( '*' : N + 1 - Baris)
Kolom <- 2="" span="">
While Kolom ≤ (2 * Baris - 1) do
Write ('*')
Kolom <-kolom 1="" span="">
Endwhile
Writeln ( )
Baris <- -="" 1="" baris="" span="">
Endwhile

0 comment:

Post a Comment