Advertisement
evgenko

Untitled

Jan 9th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.92 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <limits.h>
  4.  
  5. int main()
  6. {
  7.     int size;
  8.     printf("Enter the size of matrix: ");
  9.     scanf("%d",&size);
  10.     float matrix[size][size];
  11.     int mincolind, maxrowind;
  12.     int minelement = INT_MAX;
  13.     int maxelement = INT_MIN;
  14.     printf("Enter the elements of matrix\n");
  15.     for(int i=0;i<size;i++){
  16.         printf("Enter the %d row: ",i);
  17.         for (int j=0;j<size;j++){
  18.             scanf("%f",&matrix[i][j]);
  19.             if (minelement>matrix[i][j]){
  20.                 mincolind = j;
  21.                 minelement = matrix[i][j];
  22.             }
  23.             if (maxelement<matrix[i][j]){
  24.                 maxrowind = i;
  25.                 maxelement = matrix[i][j];
  26.             }
  27.         }
  28.     }
  29.     float mul = 1;
  30.     for (int i=0;i<size;i++){
  31.         mul*=matrix[i][mincolind];
  32.         mul*=matrix[maxrowind][i];
  33.     }
  34.     printf("mul: %f", mul);
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement