Program wysypuje się po podaniu wartości x i y

0

Witam,
Mam problem z prawidłowym działaniem programu, wysypuje sie on po podaniu wartości x i y. Podpowie mi ktoś dlaczego?

 #include <iostream>

using namespace std;

int t, x, y, a, b;
int main()
{
  cin>>t;
  for(int i=0; i<t; i++)
  {
        cin>>x>>y;

  a=2/((x+y)/(x*y));

    cout<<a<<endl;
  }
    return 0;
}
2
  1. zawsze podajemy na czym polega problem.
  2. program się kompiluje, więc to na pewno nie jest „niepoprawna kompilacja”.
0
#include <iostream>
using namespace std;
 
int main()
  {
   int t,x,y;
   for(cin>>t;t--;cout<<2.0*x*y/(x+y)<<endl) cin>>x>>y;
   return 0;
  }

1 użytkowników online, w tym zalogowanych: 0, gości: 1