Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int achandoMaior2 (int array[3][3], int i, int j, int maior)
- {
- if(j == 3)
- {
- return maior;
- }
- if (array[i][j] > maior)
- {
- maior = array[i][j];
- }
- achandoMaior2(array,i,j+1,maior);
- }
- int achandoMaior (int array[3][3], int i)
- {
- int maior;
- if(i == 3)
- {
- return maior;
- }
- maior = achandoMaior2(array,i,0,0);
- achandoMaior(array,i+1);
- }
- int escaneando_valores2 (int array[3][3], int i, int j, double media)
- {
- if(j == 3)
- {
- return media;
- }
- scanf("%d",&array[i][j]);
- media += array[i][j];
- escaneando_valores2(array,i,j+1,media);
- }
- void escaneando_valores (int array[3][3], int i, double media)
- {
- if(i == 3)
- {
- printf("%.2lf %d ",(media)/9,achandoMaior(array,0));
- if (achandoMaior(array,0) > 0) printf("1");
- else if (achandoMaior(array,0) < 0) printf("-1");
- else printf("0");
- printf(" %d",array[0][0] + array[1][1] + array[2][2]);
- return;
- }
- media = escaneando_valores2(array,i,0,media);
- escaneando_valores(array,i+1,media);
- }
- int main ()
- {
- int array[3][3];
- escaneando_valores(array,0,0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement