#include
#include
#include
int main()
{
setlocale(LC_ALL, "Russian");
int a, b;
int n;
std::cout << "Введите числитель: ";</span>
std::cin >> a;
std::cout << "Введите знаменатель:";</span>
std::cin >> b;
n = a < b ? a:b;
for(int i=1; i<=n; i++)</span>
if(!(a%i) && !(b%i))
{
a/=i;
b/=i;
}
std::cout << " " << a << " \n" << "---";</span>
if(b == 1) std::cout << " = " << a;</span>
std::cout << "\n " << b << " \n";<br>
system("pause");
return 0;
}