Răspuns:
#include<iostream>
using namespace std;
int main ()
{ int a1, b1, a2, b2;
cin >> a1 >> b1>> a2>> b2;
cout<<" fractiile sunt "<<a1<<"/"<<b1<<"si"<<a2<<"/"<<b2;
int s1, s2;
s1=a1*b2+a2*b1;
s2=b1*b2+b2*b1;
int i=2
while( i<=s1)
{if(s1%i==0 && s2%i==0)
{ s1=s1/i;
s2=s2/i;
i=i-1;}
i++;}
if(s2>1)
cout<<"suma este "<<s1<<"/"<<s2;
else
cout<<"suma este "<<s1;
s1=a1*a2;
s2=b1*b2;
i=2
while( i<=s1)
{if(s1%i==0 && s2%i==0)
{ s1=s1/i;
s2=s2/i;
i=i-1;}
i++;}
if(s2>1)
cout<<" produsul este" <<s1<<"/"<<s2;
else
cout<<" produsul este" <<s1;