Theerayut

Untitled

Nov 12th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <stdio.h>
  2. void max_Matrix(int a[10][10],int b[10][10],int c[10][10],int m,int n)
  3. {
  4. int i,j;
  5. for(i=0;i<m;i++)
  6. {
  7. for(j=0;j<n;j++)
  8. {
  9. if(a[i][j]>b[i][j])
  10. {
  11. c[i][j]=a[i][j];
  12. }
  13. else if (b[i][j]>a[i][j])
  14. {
  15. c[i][j]=b[i][j];
  16. }
  17. }
  18. }
  19. for(i=0;i<m;i++)
  20. {
  21. for(j=0;j<n;j++)
  22. {
  23. printf("%d",&c[i][j]);
  24. printf("\n");
  25. }
  26. }
  27. }
  28. int main()
  29. {
  30. int A[10][10];
  31. int B[10][10];
  32. int C[10][10];
  33. int s,f;
  34. int i,j;
  35. for(i=0;i<s;i++)
  36. {
  37. for(j=0;j<f;j++)
  38. {
  39. scanf("%d",&A[i][j]);
  40. }
  41. }
  42. for(i=0;i<s;i++)
  43. {
  44. for(j=0;j<f;j++)
  45. {
  46. scanf("%d",&B[i][j]);
  47. }
  48. }
  49. max_Matrix(A,B,C,s,f);
  50.  
  51. return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment