Advertisement
dllbridge

Untitled

Jan 13th, 2025
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3.  
  4. int foo(int number);
  5.  
  6. ////////////////////////////////////////////////
  7. int main()
  8. {
  9.    
  10.     int a;
  11.    
  12.     a = foo(10);
  13.    
  14.     printf("Position of Frog = %d \n", a);
  15. }
  16.  
  17.  
  18.  
  19. ////////////////////////////////////////////////
  20. int foo(int number)                           //
  21. {
  22.    
  23.     int n = 0;
  24.  
  25.     if (number <= 5)
  26.     {
  27.         n = number;
  28.         return n;
  29.     }
  30.  
  31.     if(number <= 10)
  32.     {
  33.              
  34.         number -= 5;
  35.        
  36.         return 5 - number;    
  37.     }
  38. }
  39.  
  40.  
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement