Advertisement
Guest User

oana

a guest
Oct 23rd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. void print(int x) {
  2.     for (int i = 1; i <= x / 2 + 1; ++ i) {
  3.         for (int j = 1; j <= 5 - i; ++ j) {
  4.             cout << "  ";
  5.         }
  6.         for (int j = 1; j <= (i - 1) * 2 + 1; ++ j) {
  7.             cout << x << " ";
  8.         }
  9.         cout << '\n';
  10.     }
  11.     for (int i = x / 2; i >= 1; -- i) {
  12.         for (int j = 1; j <= 5 - i; ++ j) {
  13.             cout << "  ";
  14.         }
  15.         for (int j = 1; j <= (i - 1) * 2 + 1; ++ j) {
  16.             cout << x << " ";
  17.         }
  18.         cout << '\n';
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement