idastan97

CSCI151 L17 P2

Sep 28th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. /*
  2.  * prog.c
  3.  *
  4.  *  Created on: Sep 29, 2016
  5.  *      Author: dastan.iyembergen
  6.  */
  7.  
  8. #include <stdio.h>
  9.  
  10. double maxVal(int len, double arr[len][len]){
  11.     int i, j;
  12.     double max;
  13.     for (i=0; i<len; i++){
  14.         for (j=0; j<len; j++){
  15.             if ((i==0 && j==0) || max<arr[i][j]) {
  16.                 max=arr[i][j];
  17.             }
  18.         }
  19.     }
  20.     return max;
  21. }
  22.  
  23. int main(){
  24.     double arr[3][3]={{456, 45.2, 4688},
  25.                       {48, 86.2, 2.3},
  26.                       {48, 48.3, 4},
  27.     };
  28.     printf("%f", maxVal(3, arr));
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment