Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,a,b,A[101][101]={};
- cin>>n>>a>>b;
- for(int i=1; i<=n;i++)
- for(int j=1; j<=n; j++)
- {
- if(i<a && j<b)
- A[i][j]=1;
- if(i<a && j>b)
- A[i][j]=2;
- if(i>a && j<b)
- A[i][j]=3;
- if(i>a && j>b)
- A[i][j]=4;
- }
- for(int i=1;i<=n;i++){
- for(int j=1;j<=n;j++)
- {
- cout<<A[i][j]<<" ";
- }
- cout<<endl;
- }
- cout<<endl;
- for(int j=1;j<=n;j++){
- for(int i=1;i<=n;i++)
- {
- cout<<A[i][j]<<" ";
- }
- cout<<endl;
- }
- return 0;
- }
- /** Tematica matrice
- -> parcurgeri linie/coloana
- -> parcurgere matrice linii, coloane
- -> generari de matrice
- -> gasire min, max, nr de aparitii
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement