Advertisement
Guest User

2mas 18-1

a guest
Dec 15th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<locale.h>
  4. #include <time.h>
  5. #pragma warning(disable:4996)
  6. #define N 5
  7. #define M 5
  8. int main(void)
  9. {
  10. setlocale(LC_ALL, "Russian");
  11. int arr[N][M], i, j, max;
  12. srand(time(NULL));
  13. for (i = 0; i < N; i++) {
  14. for (j = 0; j < M; j++) {
  15. arr[i][j] = rand() % 256;
  16. printf(" |%3d| ", arr[i][j]);
  17. }
  18. printf("\n");
  19. }
  20. for (j = 0; j < M; j++)
  21. printf(" ----- ");
  22. printf("\n");
  23. for (i = 0; i < N; i++) {
  24. max = arr[0][0];
  25. for (j = 0; j < M; j++)
  26. if (arr[i][j] > max)
  27. max = arr[i][j];
  28. printf(" %3d ", max);
  29. }
  30. printf("\n");
  31. system("pause");
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement