Advertisement
AlexandruFilipescu

Problema cu piramida pg 69 ANSI(Piramid builder with number)

Jun 6th, 2019
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int i, j, k, n;
  6.     cin >> n;
  7.    
  8.     for (i = 1; i <= n; i++) {
  9.         for (j = i; j <= n - 1; j++) { cout << "  "; }
  10.         for (j = i; j >= 1; j--) { cout << j << " "; }
  11.         for (j = 2; j <= i; j++) { cout << j << " "; }
  12.         cout << endl;
  13.     }
  14.  
  15.  
  16.     system("pause");
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement