Working on an assignment requesting to calculate the value of 'y', if 'n' and 'x' are given, Assignment:
Should the line:
P=P*(F+i/2);
be inside the 'else{ }'?!
The code:
//Calculate the value of 'y';
#include<iostream>
using namespace std;
int main()
{
double y, P=1, F=1;
int x, n, i, j;
cout<<"The value of x=";
cin>>x;
cout<<"The value of n=";
cin>>n;
for(i=1;i<=n;i++)
{
if(i==2||i==3)
{
}
else
{
for(j=1;j<=(2*i-1);j++)
{
F=F*j;
}
}
P=P*(F+i/2);
}
y=pow((2*x+3),3)+P;
cout<<"The result for the value of y="<<y<<endl;
return 0;
}