Advertisement
JacksonBarbosa

Untitled

Oct 19th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int m[3][3], l, c, aux=0, maior=0, delta=0, aux2=0;
  5. float media;
  6. for(l=0; l<3; l++){
  7. for(c=0; c<3; c++)
  8. {
  9. scanf("%d", &m[l][c]);
  10. if(l == 0 && c == 0) {
  11. maior = m[l][c];
  12. }
  13. if(m[l][c]>maior)
  14. {
  15. maior=m[l][c];
  16. }
  17. aux+=m[l][c];
  18. if(maior>=1)
  19. {
  20. delta=1;
  21. }
  22. else if (maior<0)
  23. {
  24. delta=-1;
  25. }
  26. else if(maior==0)
  27. {
  28. delta=0;
  29. }
  30. if(l==c){
  31. aux2+=m[l][c];
  32. }
  33. }
  34. }
  35. media = aux/9;
  36. printf("%.2f ", media);
  37. printf("%d ", maior);
  38. printf("%d ", delta);
  39. printf("%d \n", aux2);
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement