c语言编程练习题:7-42 整除光棍
作者:yunjinqi   类别:    日期:2023-05-29 15:07:45    阅读:143 次   消耗积分:0 分    

image.png

#include <stdio.h>

int main()
{
    int x,s=1,n=1;
    scanf("%d",&x);
    while(s<x)
    {
        s=s*10+1;
        n++;
    }
    while(1) {
        printf("%d",s/x); 
        if(s%x==0) break;
        s=(s%x)*10+1;
        n++;
    }
    printf(" %d",n);
    return 0;
}


版权所有,转载本站文章请注明出处:云子量化, http://www.woniunote.com/article/167
上一篇:c语言编程练习题:7-41 计算阶乘和
下一篇:c语言编程练习题:7-43 Shuffling Machine