#include<stdio.h>
int Gcd(int a, int b);
int main()
{
int a,b,c;
printf("Input a,b:");
scanf("%d,%d",&a,&b);
c=Gcd(a,b);
if(c==-1)
{
printf("Input number should be positive!\n");
}else
{
printf("Greatest Common Divisor of %d and %d is %d\n",a,b,c);
}
}
int Gcd(int a, int b)
{
int r;
r=a%b;
if(a<=0||b<=0)
{
return -1;
}
do
{
r=a%b;
a=b;
b=r;
}while(r!=0);
return a;
}