Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <string.h>
- #include <math.h>
- void lfs(int num, int den){
- int ans = num / den, rem = num % den;
- printf("%d ", ans);
- if(rem){
- lfs(den, rem);
- }
- }
- int main(){
- int n, d;
- scanf("%d%d", &n, &d);
- lfs(n, d);
- putchar('\n');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment