#include <iostream>
#include <string>
using namespace std;
int n;
int main(int argc, char** argv)
{
cout << "Enter number : ";
cin >> n;
for (int i = n; i >0; i--)
{
for (int j = 1; j <= n - i; j++)
{
cout << "-";
}
cout << "X";
for (int k = i * 2-1 ; k >1; k--)cout << "-";
cout << "X";
for (int m = 0; m <n-i; m++)cout << "-";
cout << endl;
}
for (int i = 1; i<=n; i++)
{
for (int j = 1; j <= n - i; j++)
{
cout << "-";
}
cout << "X";
for (int k = i * 2 - 1; k >1; k--)cout << "-";
cout << "X";
for (int m = 0; m <n - i; m++)cout << "-";
cout << endl;
}
return 0;
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น