UVa 10127 - Ones Solution
  
 Must watch:  More UVa Problem solution




#include<stdio.h>
#include<math.h>
int main()
{
    int p;
    int n,i;
    while(scanf("%d",&n)==1)
    {
        i=1;
        p=1;
        while(p%n!=0)
        {
            p=(p*10)+1;
            p=p%n;
            i++;
        }
        printf("%d\n",i);
    }
    return 0;
}

Keywords: jolly jumpers uva solution, jolly jumper program in c,uva 10127, 10038 - jolly jumpers, jolly jumper sequence, uva 10038, uva10055, 3n+1 problem solution

Post a Comment

Previous Post Next Post