Advertisement
dllbridge

Untitled

Jan 19th, 2025
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.73 KB | None | 0 0
  1.  
  2. #include  <stdio.h>
  3. #include <locale.h>
  4.  
  5. int step;
  6. int sec;
  7.  
  8. int def(int);
  9.  
  10. /////////////////////////////////////////////////////
  11. int main()
  12. {
  13.     char *locale = setlocale(LC_ALL, "");
  14.    
  15.     printf("Введите секунды:");  scanf("%d", &sec);
  16.    
  17.     step =  def(sec);
  18.    
  19.     printf("Лягушка сейчас в точке: %d", step);
  20. }
  21.    
  22.    
  23.    
  24.    
  25. //////////////////////////////////////////////////////
  26. int def(int sec_1)
  27. {
  28.    
  29.        int step_1 = 0;
  30.    
  31. L_01:  if(sec_1 <= 5) step_1 =  sec_1;
  32.  
  33.  
  34.    
  35.     if(sec_1 > 5 && sec_1<=10)
  36.     {
  37.    
  38.        step_1 = 5-(sec_1%5);
  39.     }
  40.    
  41.    
  42.     if(sec_1 > 10)
  43.     {
  44.      
  45.        sec_1 = sec_1 % 10;
  46.        goto L_01;    
  47.     }
  48.    
  49. return step_1;
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement