Advertisement
Guest User

Untitled

a guest
May 29th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. int i,j,n,mat[100][100],temp;
  7. scanf("%d",&n);
  8. for(i=0; i<n; i++)
  9. {
  10. for(j=0; j<n; j++)
  11. {
  12. printf("mat[%d][%d]=",i,j);
  13. scanf("%d",&mat[i][j]);
  14. }
  15. }
  16.  
  17. for(j=0;j<n;j++)
  18. {
  19.  
  20. for(i=0;i<n/2;i++)
  21. {
  22. if(i<n)
  23. {
  24. temp=mat[i][j];
  25. mat[i][j]=mat[n-1][j];
  26. mat[n-1][j]=temp;
  27. }
  28. }
  29. printf("%d",mat[i][j]);
  30. printf("\n");
  31. }
  32.  
  33.  
  34.  
  35.  
  36.  
  37. for(i=0;i<n;i++)
  38. {
  39. for(j=0;j<n;j++)
  40. {
  41. printf("%d\t",mat[i][j]);
  42. printf("\n");
  43. }
  44. }
  45.  
  46.  
  47. return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement