# A Program of finding GCD of Two Number.
- #include<stdio.h>
- intd,x,y;
- void s(inta,int b){
- int z;
- if(b>a){
- z=a;a=b;b=z;}
- if(b==0)
- {d=a;
- x=1;
- y=0;
- return ;}
- s(b,a%b);
- d=d;
- z=x-(a/b)*y;
- x=y;
- y=z;}
- int main ()
- {inta,b;
- scanf ("%d %d",&a,&b);
- s(a,b);
- printf("\ngcd=%d x=%d y=%d\n",d,x,y);
- return 0;
- }
No comments:
Post a Comment