Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <locale.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <conio.h>
- #include <time.h>
- #define SIZE 11
- int a[11][11];
- int n, m;
- int func(int n, int m) {
- int i; int j;
- srand(time(0));
- for (i = 0; i < n; i++) {
- for (j = 0; j < m; j++) {
- a[i][j] = rand() % 90 - 10;
- printf_s("%10d", a[i][j]);
- }
- printf_s("\n");
- }
- return (a[SIZE][SIZE]);
- return(n);
- return(m);
- }
- int check(int n, int m){
- if (n > 10 || n <= 0 || m > 10 || m <= 0){
- 1
- puts("условие не выполнено");
- return(0);
- }
- }
- int main() {
- setlocale(LC_ALL, "rus");
- printf_s("Введите число строк матрицы, меньшее 11 \n");
- scanf_s("%d", &n);
- printf_s("Введите число столбцов матрицы, меньшее 11 \n");
- scanf_s("%d", &m);
- if (check(n, m) == 0) return(0);
- func(n,m);
- int end, begin;
- int i, j;
- for (i = 0; i < n; i++) {
- if ((i + 1) % 2 == 0) {
- for (j = 0; j < (m / 2); j++) {
- end = a[i][m - 1 - j];
- begin = a[i][j];
- a[i][j] = end;
- a[i][m - 1 - j] = begin;
- }
- }
- }
- for (i = 0; i < n; i++){
- for (j = 0; j < m; j++) {
- printf_s("%10d", a[i][j]);
- }
- printf_s("\n");
- }
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement