Answer:
it will display in this pattern X XX XXX XXXX XXXXX
#include <iostream>
using namespace std;
int
main ()
{
int a,i, j=0;
cout << "enter number for length of triangle";
cin >> i;
for ( a = 1; a <= i; a++)
{
for (j = 1; j <= a; j++)
{
cout << "X";
}
cout<<" ";
}
}
for this
X
XX
XXX
XXXX
XXXXX
#include <iostream>
using namespace std;
int
main ()
{
int a,i, j=0;
cout << "enter number for length of triangle";
cin >> i;
for ( a = 1; a <= i; a++)
{
for (j = 1; j <= a; j++)
{
cout << "X";
}
cout<<endl;
}
}