Advertisement
Josif_tepe

Untitled

Dec 26th, 2022
1,107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.85 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6. int main(int argc, const char * argv[]) {
  7.     int red, kolona;
  8.     scanf("%d%d", &red, &kolona);
  9.    
  10.     double mat[red][kolona];
  11.     for(int i = 0; i < red; i++) {
  12.         for(int j = 0; j < kolona; j++) {
  13.             scanf("%lf", &mat[i][j]);
  14.         }
  15.     }
  16.    
  17.     for(int j = 0; j < kolona; j++) {
  18.         double najmal = mat[0][j];
  19.         for(int i = 0; i < red; i++) {
  20.             if(mat[i][j] < najmal) {
  21.                 najmal = mat[i][j];
  22.             }
  23.         }
  24.         for(int i = 0; i < red; i++) {
  25.             mat[i][j] = mat[i][j] / najmal;
  26.         }
  27.     }
  28.    
  29.    
  30.     for(int i = 0; i < red; i++) {
  31.         for(int j = 0; j < kolona; j++) {
  32.             printf("%.2f ", mat[i][j]);
  33.         }
  34.         printf("\n");
  35.     }
  36.     return 0;
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement