Source code:
#include <iostream> using namespace std; main(){ int n,z; cout<<"masukan n = "; cin>>n; for(int i=1;i<n*2;i+=2){ for(int b=i;b<n*2;b+=2){ cout<<" "; } for(int a=1;a<=i;a++){ cout<<"*"; } cout<<"\n"; } n=n-1; z=1; for(int i=1;i<=n*2;i+=2){ z++; for(int b=1;b<=z;b++){ cout<<" "; } for(int a=i;a<n*2;a++){ cout<<"*"; } cout<<"\n"; } return 0 ; }
Tidak ada komentar:
Posting Komentar