判断一个分数是否为无限循环小数

#include 

int main()
{
    int remiander[101] = {0};//存放余数
    int quotient[101] = {0};

    int m;
    int n;
    printf("please input (m/n)(m < n):\n");
    scanf("%d/%d",&m,&n);
    printf("m/n 是一个有限不循环小数 0.");
    for(i = 1; i <= 100; i++)
    {
        remainder[m] = i;
        m *= 10;
        quotient[i] = m / n;
        m = m % n;
        if(m == 0)
        {
            for(j = 1; j <= i; j++)
            {
                printf("%d",quotient[j]);
            }
            printf("\n");
        }
        if(remainder[m] != 0)
        {
            for(j = 1; j <= i; j++)
            {
                printf("\n\tand it is a infinaite cyclic fraction from %d\n",remainder[m]);
            printf("\tdigit to %d digit after decimal point.\n",i);

            printf("\n");
            break;

            }
        }
    }
}

你可能感兴趣的:(判断一个分数是否为无限循环小数)