View Code of Problem 53

#include<iostream>
#include<string.h>
using namespace std;
int main(){
	int n;
	cin>>n;//n-i//n-1+i
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n-1+i;j++){
			if(j<n-i)cout<<" ";
			else cout<<"*";
		}
		cout<<'\n';
	}
	for(int i=1;i<n;i++){
		for(int j=1;j<=2*n-1-2*i;j++){
			if(j<=i)cout<<" ";
			else cout<<"*"
		}
		cout<<'\n';
	}
	
} 
/*
Main.cc: In function 'int main()':
Main.cc:17:18: error: expected ';' before '}' token
    else cout<<"*"
                  ^
                  ;
   }
   ~               
*/

Double click to view unformatted code.


Back to problem 53