View Code of Problem 53

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,i,j,k;
	cin>>n;
	for(i=1;i<=n;i++){
		for(j=n-i;j>0;j--){
			cout<<' ';
		}
		for(k=0;k<2*i-1;k++){
			cout<<'*';
		}
		cout<<endl;
	}
	for(i=n-1;i>=1;i--){
		for(j=n-i;j>0;j--){
			cout<<' ';
		}
		for(k=0;k<2*i-1;k++){
			cout<<'*';
		}
		cout<<endl;
	}
}

Double click to view unformatted code.


Back to problem 53