ivanakarpuzova

Збирови

Nov 11th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.77 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int n, a, b, c, i, maxS = 0, s = 0;
  7.     int prv, vtor, tret;
  8.     scanf("%d", &n);
  9.     for(i = 0; i < n; i++)
  10.     {
  11.         scanf("%d%d%d", &a,&b,&c);
  12.         if(a < 0)
  13.         {
  14.             a = a * (-1);
  15.         }
  16.         if(b < 0)
  17.         {
  18.             b = b * (-1);
  19.         }
  20.         if(c < 0)
  21.         {
  22.             c = c * (-1);
  23.         }
  24.         if(a - b < 0) {
  25.             prv = (a-b) * (-1);
  26.         }
  27.         if(b - c < 0) {
  28.             vtor = (a-b) * (-1);
  29.         }
  30.         if(a - c < 0) {
  31.             tret = (a-c) * (-1);
  32.         }
  33.         s = prv + vtor + tret;
  34.         if(maxS < s) {
  35.             maxS = s;
  36.         }
  37.     }
  38.     printf("Najgolema vrednost e %d:", maxS);
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment