# include
Long long int the GCD (a, long long long long b)//o greatest common divisor
{
If (a % b==0) return b;
The else return the GCD (b, a % b);
}
Void huajian (* a, long long long long * b)
{
Long long t=abs (GCD (* a * b));
* a=* a/t;
* b=* b/t;
}
Void function (long long int div, long long int div)
{
Long long int k, kk;
If (Div==0) printf (" Inf ");//divisor is equal to 0
Else if (div==0) printf (" % LLD, "div);//dividend equal to 0
Else if (div & gt; 0)//dividend is larger than 0
{
Huajian (& amp; Div, & amp; Div);
If (div & lt; Div)//true score
{
Printf (" % % LLD/LLD, "div, div);//output
}
The else {//improper fraction
K=div/div.//integer part
Kk=div % div;
If (kk==0)//divisible
Printf (" % LLD ", k);
The else//not divisible
{////reduction
LLD/LLD printf (" % % % LLD ", k, kk, Div);
}
}
}
The else//dividend is less than 0
{
Huajian (& amp; Div, & amp; Div);
If (abs (div) & lt; Div)//true score
{
Printf (" (LLD/% % LLD), "div, div);
}
The else//improper fraction
{
K=div/div.//integer part
Kk=div % div;
If (kk==0)
Printf (" % (LLD) ", k);//divisible
The else
{
Printf (" (LLD) LLD/LLD % % % ", k, abs (kk), Div);
}
}
}
}
Void add_min_mul_div (long long int a, long long int b, char sign, long long int c, long long int d)
{
A function (a, b);
Printf (" % c ", sign);
Base (c, d);
Long long int a1, a2,
The switch (sign)
{
Case '+' : a1=a + b * * d c; A2=b * d; break;
Case '-' : a1=a * d - b * c; A2=b * d; break;
Case '*' : a1=a * c; A2=b * d; break;
Case '/' : a1=a * d; A2=b * c; If (a2 & lt; 0 {a1=- a1; A2=- a2; } break;//that the denominator is greater than 0
}
Printf ("=");
A function (a1, a2);
}
Int main ()
{
Char sign []={' + ', '-' and '*', '/'};
Long long a, b, c, d;
The scanf (" % LLD/LLD/LLD % % % LLD ", & amp; A, & amp; B, & amp; C., & amp; D);
for (int i=0; i <4. I++)
{
Add_min_mul_div (a, b, sign [I], c, d); printf("\n");
}
//the while (1);
return 0;
}
On the Internet to see a similarity is very high and I code https://www.jianshu.com/p/9f2e6f3c112c I this and what he where different dew collapsed NNM