Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- main (){
- int b,x,y,z;
- cout<<"Masukkan Batas : ";
- cin>>b;
- cout<<endl;
- for (y=1;y<=b-1;y++){
- for (z=y;z<=b;z++) {
- cout<<" ";
- }
- for (x=1;x<=y-1;x++){
- if (x==1)
- cout<<" *";
- else
- cout<<" ";
- }
- for (x=y;x>=1;x--) {
- if (x==1)
- cout<<" *";
- else
- cout<<" ";
- }
- cout<<endl;
- }
- for (y=b;y>=1;y--){
- for (z=y;z<=b;z++) {
- cout<<" ";
- }
- for (x=1;x<=y-1;x++){
- if (x==1)
- cout<<" *";
- else
- cout<<" ";
- }
- for (x=y;x>=1;x--) {
- if (x==1 or x==b)
- cout<<" *";
- else
- cout<<" ";
- }
- cout<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement