#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[])
{
int a,b;
scanf("%d %d",&a,&b);
while(a%b !=0)
{
int temp=a%b;
printf("%d %d %d 連分數:%d\n",a,b,a%b,a/b);
a=b;
b=temp;
}
printf("連分數:%d\n",a/b);
return 0;
}
沒有留言:
張貼留言