This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
NG_2024_Stanislav_Mykhailenko/Lesson_1/Task_6/main.cpp

28 lines
579 B
C++
Raw Normal View History

2024-06-04 08:40:07 +00:00
#include <iostream>
2024-06-11 07:48:26 +00:00
using namespace std;
2024-06-04 08:40:07 +00:00
int main()
{
int size = 0;
2024-06-11 07:48:26 +00:00
cout << "Enter size: ";
cin >> size;
2024-06-04 08:40:07 +00:00
for (int iteration = 0; iteration < size; ++iteration) {
int spaces = size - iteration - 1;
int asterisks = 1 + iteration * 2;
for (int space = 0; space < spaces; ++space)
2024-06-11 07:48:26 +00:00
cout << " ";
2024-06-04 08:40:07 +00:00
for (int asterisk = 0; asterisk < asterisks; ++asterisk)
2024-06-11 07:48:26 +00:00
cout << "*";
cout << endl;
2024-06-04 08:40:07 +00:00
}
for (int space = 0; space < size - 1; ++space)
2024-06-11 07:48:26 +00:00
cout << " ";
cout << "*" << endl;
2024-06-04 08:40:07 +00:00
return 0;
}