Advertisement
Guest User

ggg

a guest
Feb 24th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int v[20][20],i,j,n;
  8. cout<<"Numarul de linii si coloane=";
  9. cin>>n;
  10. for(i=1;i<=n;i++)
  11. {
  12. for(j=1;j<=n;j++)
  13. {
  14. cout<<"v["<<i<<"]["<<j<<"]=";
  15. cin>>v[i][j];
  16. }
  17. cout<<endl;
  18. }
  19. cout<<"Matricea:"<<endl;
  20. for(i=1;i<=n;i++)
  21. {
  22. for(j=1;j<=n;j++)
  23. {
  24. cout<<v[i][j]<<" ";
  25. }
  26. cout<<endl;
  27. }
  28. cout<<"Diagonala principala: "<<endl;
  29. for(i=1;i<=n;i++)
  30. {
  31. for(j=1;j<=n;j++)
  32. {
  33. if(i==j)
  34. {
  35. cout<<v[i][j]<<" ";
  36. }
  37. }
  38. }
  39. cout<<endl;
  40. cout<<"Zona N:"<<endl;
  41. for(i=1;i<=n;i++)
  42. {
  43. for(j=1;j<=n;j++)
  44. {
  45. if(i<j && (i+j)<(n+1))
  46. cout<<v[i][j]<<" ";
  47. }
  48. }
  49. cout<<endl;
  50. cout<<"Zona E:"<<endl;
  51. for(i=1;i<=n;i++)
  52. {
  53. for(j=1;j<=n;j++)
  54. {
  55. if(i<j && (i+j)>(n+1))
  56. {
  57. cout<<v[i][j]<<" ";
  58. }
  59. }
  60. }
  61. return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement