SHARE
TWEET

Untitled

a guest Oct 21st, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <locale.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <conio.h>
  5. #include <time.h>
  6. #define SIZE 11
  7. int a[11][11];
  8. int n, m;
  9. int func(int n, int m) {
  10. int i; int j;
  11. srand(time(0));
  12. for (i = 0; i < n; i++) {
  13. for (j = 0; j < m; j++) {
  14. a[i][j] = rand() % 90 - 10;
  15. printf_s("%10d", a[i][j]);
  16. }
  17. printf_s("\n");
  18. }
  19. return (a[SIZE][SIZE]);
  20. return(n);
  21. return(m);
  22. }
  23. int check(int n, int m){
  24. if (n > 10 || n <= 0 || m > 10 || m <= 0){
  25. 1
  26. puts("условие не выполнено");
  27. return(0);
  28. }
  29. }
  30. int main() {
  31. setlocale(LC_ALL, "rus");
  32. printf_s("Введите число строк матрицы, меньшее 11 \n");
  33. scanf_s("%d", &n);
  34. printf_s("Введите число столбцов матрицы, меньшее 11 \n");
  35. scanf_s("%d", &m);
  36. if (check(n, m) == 0) return(0);
  37. func(n,m);
  38. int end, begin;
  39. int i, j;
  40. for (i = 0; i < n; i++) {
  41. if ((i + 1) % 2 == 0) {
  42. for (j = 0; j < (m / 2); j++) {
  43. end = a[i][m - 1 - j];
  44. begin = a[i][j];
  45. a[i][j] = end;
  46. a[i][m - 1 - j] = begin;
  47. }
  48. }
  49. }
  50. for (i = 0; i < n; i++){
  51. for (j = 0; j < m; j++) {
  52. printf_s("%10d", a[i][j]);
  53. }
  54. printf_s("\n");
  55. }
  56. return(0);
  57. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top