Advertisement
Farjana_akter

Untitled

Feb 17th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4.  
  5. int main()
  6. {
  7. int n,i,j,k,count=0,a[105][105],b,c,d,e,f;
  8. cin>>n;
  9. for(i=0;i<(2*n)-1;i++)
  10. {
  11. for(j=0;j<=i&&j<n;j++)
  12. {
  13. if(i-j>=0 && i-j<n)
  14. {
  15. a[j][i-j]=++count;
  16. // cout<<a[j][i-j]<<" ";
  17. }
  18. }
  19. }
  20. for(i=0;i<n;i++)
  21. {
  22. for(j=n-1;j>=0;j--)
  23. cout<<a[i][j]<<" ";
  24. cout<<endl;
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement