Răspuns:
#include <iostream>
using namespace std;
int main()
{
float n,m,S1=0,S2=0,i;
cout<<"n=";
cin>>n;
cout<<"m=";
cin>>m;
if(n>m)
{
for(i=1;i<=n;i++)
{
S1=S1+(i*(i+1));
S2=S2+n+i;
}
S1=S1/S2;
cout<<S1;
S2=0;
for(i=2;i<=n;i++)
S2=S2+(1-(1/i));
cout<<" "<<S2;
}
else if(n==m)
{
for(i=1;i<=n;i++)
S1=S1+(1/(i*(i+1)));
cout<<S1;
}
return 0;
}
Explicație:
Multumesc+5 stele+cel mai inteligent raspuns?