#include <iostream>
int main()
{
int n = 12 ;
// TO DO: accept the value of n from user input
for( int row = 0 ; row < n ; ++row ) // for each of the first n rows
{
constint nstars = n - row ; // number of stars in this row
// print 'nstars' stars
for( int col = 0 ; col < nstars ; ++col ) std::cout << '*' ;
std::cout << '\n' ;
}
for( int row = 0 ; row < n ; ++row ) // for each of the second set of n rows
{
constint nstars = row+1 ; // number of stars in this row
// print 'nstars' stars
for( int col = 0 ; col < nstars ; ++col ) std::cout << '*' ;
std::cout << '\n' ;
}
}
#include <iostream>
#include <cstdlib>
usingnamespace std;
int main()
{
int N = 5;
for ( int i = N; i >= -N; i--)
{
for ( int j = 1; j <= abs( i ); j++ ) cout << "*";
if ( i ) cout << '\n';
}
}