Advertisement
sLobodaNNN

Untitled

Dec 29th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. //============================================================================
  2. // Name : DZX.cpp
  3. // Author : Doozy
  4. // Version :
  5. // Copyright : Doozy
  6. // Description : Hello World in C++, Ansi-style
  7. //============================================================================
  8.  
  9. #include <iostream>
  10. using namespace std;
  11.  
  12. int main(){
  13. int n,k=1,m;
  14. cin >> n;
  15. int a[n][n];
  16. for(int i=0;i<n;i++){
  17. for(int j=0;j<n;j++){
  18. a[i][j]= k++;
  19. }
  20. }
  21. for(int i=0;i<n;i++){
  22. k=i;
  23. for(int j=0;j<=i;j++){
  24. cout << a[k][j] << endl;
  25. k--;
  26. }
  27. cout << endl;
  28. }
  29. cout << endl << endl;
  30. k=n-1;
  31. for(int i=1;i<n;i++){
  32. m=i;
  33. for(int j=k;j>=i;j--){
  34. cout << a[j][m] << endl;
  35. m++;
  36. }
  37. cout << endl;
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement