35657

Untitled

Feb 16th, 2024
868
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main() {
  7.  
  8.     // необходимо вывести наиболешее из двух чисел
  9.  
  10.     setlocale(LC_ALL, "ru");
  11.  
  12.     int a;
  13.  
  14.     cout << "Введите размер фигуры (нечетное число): ";
  15.     cin >> a;
  16.  
  17.     for (int i = 0; i < a; i++) {
  18.         for (int j = 0; j < a; j++) {
  19.             if (j >= i) {
  20.                 cout << " * ";
  21.             }
  22.             else {
  23.                 cout << "   ";
  24.             }
  25.         }
  26.         cout << endl;
  27.     }
  28.     cout << endl;
  29.  
  30.  
  31.     for (int i = 0; i < a; i++) {
  32.         for (int j = 0; j < a; j++) {
  33.             if (j < a - i) {
  34.                 cout << " * ";
  35.             }
  36.             else {
  37.                 cout << "   ";
  38.             }
  39.         }
  40.         cout << endl;
  41.     }
  42.     cout << endl;
  43.  
  44.     for (int i = 0; i < a; i++) {
  45.         for (int j = 0; j < a; j++) {
  46.             if (j >= i && j < a - i) {
  47.                 cout << " * ";
  48.             }
  49.             else {
  50.                 cout << "   ";
  51.             }
  52.         }
  53.         cout << endl;
  54.     }
  55.     cout << endl;
  56.    
  57. }
Advertisement
Add Comment
Please, Sign In to add comment