Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //============================================================================
- // Name : DZX.cpp
- // Author : Doozy
- // Version :
- // Copyright : Doozy
- // Description : Hello World in C++, Ansi-style
- //============================================================================
- #include <iostream>
- using namespace std;
- int main(){
- int n,k=1,m;
- cin >> n;
- int a[n][n];
- for(int i=0;i<n;i++){
- for(int j=0;j<n;j++){
- a[i][j]= k++;
- }
- }
- for(int i=0;i<n;i++){
- k=i;
- for(int j=0;j<=i;j++){
- cout << a[k][j] << endl;
- k--;
- }
- cout << endl;
- }
- cout << endl << endl;
- k=n-1;
- for(int i=1;i<n;i++){
- m=i;
- for(int j=k;j>=i;j--){
- cout << a[j][m] << endl;
- m++;
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement