SelinD

ex34

Jun 21st, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. void sub(int n,int m,int a[25][25],int v[100])
  5. {
  6. int i,j,l=0;
  7. for(j=1;j<=m;j++)
  8. {
  9. for(i=n;i>=1;i--)
  10. {
  11. v[++l]=a[i][j];
  12. }
  13. }
  14. }
  15.  
  16. int main()
  17. {
  18. int a[25][25],v[100],i,j,n,m;
  19. cin>>n>>m;
  20. for(i=1;i<=n;i++)
  21. for(j=1;j<=m;j++)
  22. cin>>a[i][j];
  23. sub(n,m,a,v);
  24. for(i=1;i<=n*m;i++)
  25. {
  26. cout<<v[i]<<" ";
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment