Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int a[15][15], n = 3, m = 5;
- // a - массив с числами
- // n, m - у нас есть
- // Для счета 1 ... 15
- int c = 1;
- for(int i=0; i<n; i++){
- // Для непарных рядков записываем слева на право
- if (i % 2 == 0){
- for(int j=0; j<m; j++)
- a[i][j] = c;
- }
- // Для непарных - справа на лево
- else{
- for(int j=m-1; j>=0; j--)
- a[i][j] = c;
- }
- c++;
- }
Add Comment
Please, Sign In to add comment