Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n,i,j,k,count=0,a[105][105],b,c,d,e,f;
- cin>>n;
- for(i=0;i<(2*n)-1;i++)
- {
- for(j=0;j<=i&&j<n;j++)
- {
- if(i-j>=0 && i-j<n)
- {
- a[j][i-j]=++count;
- // cout<<a[j][i-j]<<" ";
- }
- }
- }
- for(i=0;i<n;i++)
- {
- for(j=n-1;j>=0;j--)
- cout<<a[i][j]<<" ";
- cout<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement