View Code of Problem 102

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int f(int a,int b)
{
    int c=a%b;
    while(c!=0)
    {
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

int main()
{
        int x,y,num,i;
        while(scanf("%d%d",&x,&y)!=EOF)
        {
            num=0;
            for(i=y;i>=x;i=i-x)
            {
                if((x*y)%i==0&&f((x*y)/i,i)==x)
                {
                    num++;
                }
            }
            printf("%d\n",num);
        }
        return 0;
}

Double click to view unformatted code.


Back to problem 102