#include<iomanip>
using namespace std;
int main()
{
int x,N;
cout << "Enter any number for the height of the isosceles triangle: ";
cin >> N;
int space = N;
x=N;
for( int i=1 ; i<=N ; i++)
{
cout << setw(space);
space-=1;
for( int j=x-i ; j<N ; j++ )
{
if( i==N )
cout << "*";
else if( j==x-i || j==N-1 )
cout << "*";
else
cout << " ";
}
x-=1;
cout << endl;
}
return 0;
}
}
No comments:
Post a Comment