Hey guys!!
First of all thank you so much for being so patient and helpful with me as I am a complete dummy here.
Secondly Yesss!! I could finally sort my program and solve it all thanks to everyone here.
this was my final code:-
#include <iostream>
usingnamespace std;
int main()
{
double x, sum=0.0, term;
int n, i;
cout<<"Enter the value of x : ";
cin>>x;
cout<<"Enter the value of n : ";
cin>>n;
//a setting the variables
term=x;
sum=term;
//b work for odd numbers only
if(n % 2 != 0 )
//c loop to run for computation
{
for ( i=1; i<n; i+=2)
term*=-x*x/ (( i+1 ) * ( i + 2 ) ) ; //d series computation
sum += term;
}
cout<<"y= ="<< sum <<endl;
return 0;
}