Contoh Latihan Algoritma (C++)

int main(){
clrscr();
int x, y, z, bil=10;
for( x = bil; x >= 1; x– ){
for( z = x; z <= bil; z++ )
cout < x; z– ){
y = z % 10;cout << "*";}
for( z = x; z <= 2*(x-1); z++ ){
y = z % 10;
cout << "*";}
cout << endl;}
getch();
}
================================================]

#include
#include
int main(){
clrscr();
int x, y, z, bil=10;
for( x = bil; x >= 1; x– ){
for( z = x; z <= bil; z++ )
cout < x; z– ){
y = z % 10;
cout << ' ';}
for( z = x; z <= 2*(x-1); z++ ){
y = z % 10;
cout <= x; z– )
cout << '*';
cout << endl;
}
getch();
}

==============================================

int main(){
clrscr();
int x, y, z, bil=10;
for( x = 1; x = x; z– )
cout << ' ';
for( z = x; z < 2*x; z++ ){
y = z % 10;cout <= x; z– ){
y = z % 10;
cout << y;}
cout << endl;}
getch();
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

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

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: