View Code of Problem 53

#include<iostream>
using namespace std;
int main(){
	int n;
	while(cin>>n){	
	for(int i=0;i<n;i++){
		for(int j=0;j<n-i-1;j++){
			cout<<' ';
		}
		for(int j=0;j<2*i+1;j++){
			cout<<'*';
		}
		cout<<endl;
	}
	for(int i=1;i<n;i++){
		for(int j=0;j<i;j++){
			cout<<' ';
		}
		for(int j=2*(n-1)+1;j>2*i;j--){
			cout<<'*';
		}
		cout<<endl;
	}
}
}

Double click to view unformatted code.


Back to problem 53