Computer Science, asked by sbsarkar009, 3 months ago

4) Write a menu driven program using switch case statement to print the following
i) Print the addition of the following series
S=xy/2! + xy/4! + xy/6! +.................N terms
ii) Print the addition of the following series
S=x2 + x + x4 + .............. N​


sbsarkar009: please help in this question
sbsarkar009: please
sbsarkar009: quickly please

Answers

Answered by tejava831943
0

Answer:

int fact(int n){

return (n==0||n==1)?n:n*fact(n-1);

}

int main(){

int choice;

//enter 1 or 2

cin>>choice;

switch(choice){

case 1:

int n,sum=0;

cin>>n;

for(int i=1;i<=n/2;i++){

sum+=(x)(y)/fact(2*i);

};

return sum;

case 2:

int sum=0;

for(int i=1;i<=n/2;i++){

sum+=(x)(2*i);

};

sum+=(n/2)(x);

return sum;

}

}

return 0;

}

Explanation:

C++ partialy solution for immediate purpose only


sbsarkar009: thank u so much
Similar questions