MUstar

IoT C언어 0619 - ex_03

Jun 19th, 2017
67
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int output(void);
  4. void rotate(int *pa, int *pb, int *pc);
  5.  
  6. int main(void)
  7. {
  8.     output();
  9.     return 0;
  10. }
  11.  
  12.  
  13. int output(void)
  14. {
  15.     int n1 = 1, n2 = 2, n3 = 3;
  16.     char rw_input;
  17.     while(1)
  18.     {
  19.         printf("%d:%d:%d",n1,n2,n3);
  20.         rotate(&n1,&n2,&n3);
  21.         scanf("%c",&rw_input);
  22.         if(rw_input != 10) break;
  23.     }
  24. }
  25. void rotate(int *pa, int *pb, int *pc)
  26. {
  27.     int num_temp;
  28.    
  29.     num_temp = *pa;
  30.     *pa = *pb;
  31.     *pb = *pc;
  32.     *pc = num_temp;
  33. }
RAW Paste Data