Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- FILE *izlez= fopen("matrica.txt", "w");
- int m, n, r, k, i, j;
- scanf("%d %d %d %d", &m, &n, &r, &k);
- int matrica[m][n];
- for(i = 0; i < m; i++){
- for(j = 0; j < n; j++){
- scanf("%d ", &matrica[i][j]);
- }
- }
- int minimalna = 2000000000;
- for(i = 0; i < m; i++){
- for(j = 0; j < n; j++){
- if (matrica[i][j] < minimalna){
- minimalna = matrica[i][j];
- }
- }
- }
- for(i = 0; i < r; i++){
- for(j = 0; j < k; j++){
- matrica[i][j] = minimalna;
- }
- }
- for(i =0 ; i < m; i++){
- for(j = 0; j < n; j++){
- fprintf(izlez, "%d ", matrica[i][j]);
- }
- fprintf(izlez, "\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement