MUstar

IoT C언어 0619 - ex_02

Jun 19th, 2017
70
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. void swap(double *pa, double *pb);
  4. void line_up(double *maxp, double *midp, double *minp);
  5.  
  6. int main(void)
  7. {
  8.     double max,mid,min;
  9.  
  10.     printf("실수값 세 개 입력 : ");
  11.     scanf("%lf%lf%lf", &max,&mid, &min);
  12.     line_up(&max, &mid, &min);
  13.     printf("정력된 값 출력 : %.1lf, %.1lf, %.1lf\n", max,mid,min);
  14.  
  15.     return 0;
  16. }
  17. void swap(double *pa, double *pb)
  18. {
  19.     double temp;
  20.     temp = *pa;
  21.     *pa = *pb;
  22.     *pb = temp;
  23. }
  24. void line_up(double *maxp, double *midp, double *minp)
  25. {
  26.     while(1){
  27.     if(*maxp<=*midp)swap(maxp,midp);
  28.     if(*midp<=*minp)swap(midp,minp);
  29.     if(*maxp<=*minp)swap(maxp,minp);
  30.     if((*maxp>=*midp)&&(*midp>=*minp))break;
  31.     }
  32. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×