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. for(int i =1;i<=n;i++){
  9. for(int j=1;j<=n-i;j++){
  10. cout<<" ";
  11. }
  12. for(int j =i;j<=2*(i-1)+1;j++){
  13. cout<<j;
  14. }
  15. for(int j =2*(i-1);j>=i;j--){
  16. cout<<j;
  17. }
  18. cout<<endl;
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0s 5312KB
stdin
4
stdout
   1
  232
 34543
4567654