Identifikasi :
- Inputan : a
- Output : *
Alogoritma :
1. Deklarasi : int a
2. Deskripsi :
- masukan a
- while (a%2==0);
for (i=0;i<=a;i+=2) {
for (j=0;j<a-i;j+=2) {
cout<<" ";
}
for (z=0;z<=i;z++) {
cout<<"*";
}
cout<<endl;
}
a=a-2;
for (i=0;i<a;i+=2) {
for (j=0;j<=i+2;j+=2) {
cout<<" ";
}
for (z=1;z<=a-i;z++) {
cout<<"*";
}
cout<<endl;
}
cout<<endl;
}
Membuat Diamond
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar