Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int achandoMaior2 (int array[3][3], int i, int j, int maior)
  4. {
  5. if(j == 3)
  6. {
  7. return maior;
  8. }
  9. if (array[i][j] > maior)
  10. {
  11. maior = array[i][j];
  12. }
  13. achandoMaior2(array,i,j+1,maior);
  14. }
  15.  
  16. int achandoMaior (int array[3][3], int i)
  17. {
  18. int maior;
  19. if(i == 3)
  20. {
  21. return maior;
  22. }
  23. maior = achandoMaior2(array,i,0,0);
  24. achandoMaior(array,i+1);
  25. }
  26.  
  27. int escaneando_valores2 (int array[3][3], int i, int j, double media)
  28. {
  29. if(j == 3)
  30. {
  31. return media;
  32. }
  33. scanf("%d",&array[i][j]);
  34. media += array[i][j];
  35. escaneando_valores2(array,i,j+1,media);
  36. }
  37.  
  38. void escaneando_valores (int array[3][3], int i, double media)
  39. {
  40. if(i == 3)
  41. {
  42. printf("%.2lf %d ",(media)/9,achandoMaior(array,0));
  43. if (achandoMaior(array,0) > 0) printf("1");
  44. else if (achandoMaior(array,0) < 0) printf("-1");
  45. else printf("0");
  46. printf(" %d",array[0][0] + array[1][1] + array[2][2]);
  47. return;
  48. }
  49. media = escaneando_valores2(array,i,0,media);
  50. escaneando_valores(array,i+1,media);
  51. }
  52.  
  53. int main ()
  54. {
  55. int array[3][3];
  56. escaneando_valores(array,0,0);
  57. return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement