Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int euklides(int a, int b);
- int main()
- {
- int a, b;
- printf("prosze wprowadzic liczbe pierwsza\n");
- scanf("%d");
- printf("prosze wprowadzic liczbe druga\n");
- scanf("%d");
- printf("najwiekszy wspolny dzielnik liczb ktore podales to: %d\n ", euklides(a,b) );
- }
- int euklides(int a, int b)
- {
- if(a==0 || b==1 || a==b)
- return b;
- if(b==0 || a==1)
- return a;
- if(a>b)
- return euklides(a%b, b);
- if(a<b)
- return euklides(a, b%a);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement