Varianta 86 / Subiectul 2 / Problema 5 |
#include<iostream.h> int a[21][21],n; void main() { cin>>n; int par=2; int imp=1; int i,j; for(i=1;i<=2*n;i++) if(i%2==1) for(j=1;j<=2*n;j++) {a[i][j]=imp; imp+=2;} else for(j=2*n;j>=1;j--) {a[i][j]=par; par+=2;} for(i=1;i<=2*n;i++) { cout<<endl; for(j=1;j<=2*n;j++) cout<<a[i][j]<<" "; } } |