View Code of Problem 102

#include<bits/stdc++.h>
using namespace std;
int gcd(int,int);
int main(){
	int x,y;
	while(scanf("%d%d",&x,&y)!=EOF){
		int num = 0;
		for(int i = x;i<=y;i++){
			if((x*y) % i ==0){
				if(gcd(i,(x*y)/i)==x)num++;
			}
		}
		cout<<num<<endl;
	}
	return 0;
} 
int gcd(int a,int b){
	if(b==0)return a;
	else return gcd(b,a%b);
} 

Double click to view unformatted code.


Back to problem 102