Advertisement
lukasd

zadanie 3 kolokwium 1

Feb 9th, 2018
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. void kolos1()
  2. {
  3.     float a;
  4.     float b;
  5.     float c;
  6.     float d;
  7.     scanf("%f", &b);
  8.     scanf("%f", &c);
  9.     scanf("%f", &d);
  10.  
  11.     int maxR = 0;
  12.  
  13.  
  14.     if ((b==c && c==d) || (b<c && c<d) || (b>c&&c>d))
  15.     {
  16.         do
  17.         {
  18.             a = b;
  19.             b = c;
  20.             c = d;
  21.  
  22.             if (maxR < abs(a - b))
  23.             {
  24.                 maxR = abs(a - b);
  25.             }
  26.  
  27.             scanf("%f", &d);
  28.         } while ((b == c && c == d) || (b<c && c<d) || (b>c&&c>d));
  29.  
  30.         if (maxR < abs(b - c))
  31.         {
  32.             maxR = abs(b - c);
  33.         }
  34.  
  35.     }
  36.     else
  37.     {
  38.         maxR = abs(b - c);
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement