hamaXD

Final 57 Matrix

Dec 5th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1.  // 1 big
  2. //1.1
  3. #include<stdio.h>
  4. int maxValue(int Matrix[4][3]);
  5. int main(){
  6.     int num[4][3];
  7.     int max;
  8.     int i,j;
  9.     printf("Enter elements of Matrix M[4x3]\n");
  10.     for(i=0;i<4;i++){
  11.         for(j=0;j<3;j++){
  12.             printf("M[%d][%d]:",i+1,j+1);
  13.             scanf("%d",&num[i][j]);
  14.         }
  15.     }
  16.     max=maxValue(num); 
  17.     printf("%d",max);
  18.     return 0;
  19. }
  20. int maxValue(int Matrix[4][3]){
  21.     int x;
  22.     int i=0,j=0;
  23.     x = Matrix[0][0];
  24.    
  25.     for(i=0;i<4;i++){
  26.         for(j=0;j<3;j++){
  27.            if(Matrix[i][j]>x){
  28.                 x=Matrix[i][j];
  29.             }
  30.         }
  31.     }
  32.     return x;
  33.    
  34. }
Advertisement
Add Comment
Please, Sign In to add comment