Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int euclides(int a, int b, int i, int q[])
- {
- if(a % b == 0)
- {
- ++i;
- q[i] = a / b;
- printf("MDC = %d\n", b);
- return --i;
- }
- else
- {
- q[i] = a / b;
- euclides(b, a % b, ++i, q);
- }
- }
- void ordenar(int q[], int st[], int t, int t1, int i)
- {
- if(t < 0)
- {
- return;
- }
- else
- {
- st[t1] = q[t];
- printf("%d\n", st[i]);
- ordenar(q, st, --t, ++t1, ++i);
- }
- }
- int main()
- {
- int a,b, i;
- scanf("%d %d", &a, &b);
- int q[999];
- int t = euclides(a, b, 0, q);
- int st[t - 1];
- ordenar(q, st, t - 1, 0, 0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement