Guest User

Untitled

a guest
Jan 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. 0
  2. 0 1 0
  3. 0 1 2 1 0
  4. 0 1 2 3 2 1 0
  5. 0 1 2 1 0
  6. 0 1 0
  7. 0
  8.  
  9. #include <iostream>
  10.  
  11.  
  12. using namespace std;
  13.  
  14. int main()
  15. {
  16. unsigned i,k=0,n;
  17. cout<<"n= "; cin>>n;
  18.  
  19. while(k<=n)
  20. {
  21.  
  22. for (i=0;i<=k;i++)
  23. cout<<i;
  24. for (i=k;i>0;i--)
  25. cout<<i-1;
  26. cout<<endl;
  27. k++;
  28. }
  29.  
  30. k=n;
  31.  
  32. while (k)
  33. {
  34. k--;
  35. for (i=0;i<=k;i++)
  36. cout<<i;
  37. for (i=k;i>0;i--)
  38. cout<<i-1;
  39. cout<<endl;
  40.  
  41. }
  42. }
  43.  
  44. unsigned i;
  45. unsigned k = 0;
  46. unsigned n;
  47.  
  48. cout << "n= ";
  49. cin >> n;
Add Comment
Please, Sign In to add comment