Advertisement
Bisus

Untitled

Oct 12th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. int scanf(const char *,...);
  2. int printf(const char *,...);
  3. void f(double x, double y, double z, double *a, double *b);
  4.  
  5. void f(double x, double y, double z, double *a/* Здесь будет максимум */, double *b/* Здесь будет минимум */)
  6. {
  7.     *a = x;
  8.     if(y>*a) *a = y;
  9.     if(z>*a) *a = z;
  10.  
  11.     *b = x;
  12.     if(y<*b) *b = y;
  13.     if(z<*b) *b = z;
  14. }
  15.  
  16. int main(void)
  17. {
  18.     double x, y, z, a, b;
  19.  
  20.     printf("Input: (x,y,z)\n");
  21.     scanf("%lf%lf%lf", &x, &y, &z);
  22.  
  23.     f(x, y, z, &a, &b);
  24.     printf("a=%lf\tb=%lf\n", a, b);
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement