fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int n;
  7. cin >> n;
  8.  
  9. for (int i = 0; i < n; i++) {
  10. for (int j = 0; j < n - i - 1; j++) {
  11. cout << ".";
  12. }
  13. for (int j = i + 1; j <= 2 * i + 1; j++) {
  14. cout << j;
  15. }
  16. for (int j = 2 * i; j >= i + 1; j--) {
  17. cout << j;
  18. }
  19. cout << endl;
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 5320KB
stdin
5
stdout
....1
...232
..34543
.4567654
567898765