wojiaocbj

E4-F

Mar 29th, 2023
918
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5. #include <math.h>
  6. void lfs(int num, int den){
  7.     int ans = num / den, rem = num % den;
  8.     printf("%d ", ans);
  9.     if(rem){
  10.         lfs(den, rem);
  11.     }
  12. }
  13. int main(){
  14.     int n, d;
  15.     scanf("%d%d", &n, &d);
  16.     lfs(n, d);
  17.     putchar('\n');
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment