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
Answers
Answered by
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
Similar questions
Social Sciences,
1 month ago
English,
1 month ago
Math,
1 month ago
Science,
3 months ago
Social Sciences,
3 months ago
Social Sciences,
9 months ago