Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int v[20][20],i,j,n;
- cout<<"Numarul de linii si coloane=";
- cin>>n;
- for(i=1;i<=n;i++)
- {
- for(j=1;j<=n;j++)
- {
- cout<<"v["<<i<<"]["<<j<<"]=";
- cin>>v[i][j];
- }
- cout<<endl;
- }
- cout<<"Matricea:"<<endl;
- for(i=1;i<=n;i++)
- {
- for(j=1;j<=n;j++)
- {
- cout<<v[i][j]<<" ";
- }
- cout<<endl;
- }
- cout<<"Diagonala principala: "<<endl;
- for(i=1;i<=n;i++)
- {
- for(j=1;j<=n;j++)
- {
- if(i==j)
- {
- cout<<v[i][j]<<" ";
- }
- }
- }
- cout<<endl;
- cout<<"Zona N:"<<endl;
- for(i=1;i<=n;i++)
- {
- for(j=1;j<=n;j++)
- {
- if(i<j && (i+j)<(n+1))
- cout<<v[i][j]<<" ";
- }
- }
- cout<<endl;
- cout<<"Zona E:"<<endl;
- for(i=1;i<=n;i++)
- {
- for(j=1;j<=n;j++)
- {
- if(i<j && (i+j)>(n+1))
- {
- cout<<v[i][j]<<" ";
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement