#include
#include
using namespace std;
int main()
{
setlocale(0, "");
int S = 0, P = 1, A = 0, y;
cout << " |s=(4*y)+(6*y)+…+(14*y), если y < 0" << endl;
cout << "A=|" << endl;
cout << " |P=(1+sin(y))*(2+sin(y))*…*(5+sin(y)), если y >= 0" << endl;
cout << "Введите y: ";
cin >> y;
if (y < 0)
{
for (int n = 1; n <= 5; n++)
{
S += (2 * n + 2) * y;
}
cout << "S = " << S << endl;
}
else
{
for (int n = 1; n <= 5; n++)
{
P *= (n + sin(y));
}
cout << "P = " << P << endl;
}
return 0;
}
Результат выполнения