#include <iostream>
using namespace std;
int main()
{
// a
for (int i = 1; i <= 10; i++)
{
for (int j = 1; j <= 10; j++)
{
if (j <= i)
{
cout << "*";
}
else
{
cout << " ";
}
}
cout << endl;
}
cout << endl;
// b
for (int i = 10; i >= 1; i--)
{
for (int j = 1; j <= 10; j++)
{
if (j <= i)
{
cout << "*";
}
else
{
cout << " ";
}
}
cout << endl;
}
cout << endl;
// c
for (int i = 1; i <= 10; i++)
{
for (int j = 1; j <= 10; j++)
{
if (i <= j)
{
cout << "*";
}
else
{
cout << " ";
}
}
cout << endl;
}
cout << endl;
// d
for (int i = 10; i >= 1; i--)
{
for (int j = 1; j <= 10; j++)
{
if (i <= j)
{
cout << "*";
}
else
{
cout << " ";
}
}
cout << endl;
}
return 0;
}
No comments:
Post a Comment