1*2*3*4*5*6*7*8*9*10= trick??
Answers
Answered by
1
3628800 is the correct answer.............................
adianshu1:
trick??
Answered by
0
// Program to print the solution of the series
// f(n)= (1) + (2*3) + (4*5*6) ... n using recursion
#include <stdio.h>
// Recursive function for finding sum of series
// calculated - number of terms till which sum of terms has
// been calculated
// current - number of terms for which sum has to be
// calculated
// N - Number of terms in the function to be calculated
int seriesSum(int calculated, int current, int N)
{
int i, cur = 1;
// checking termination condition
if (current == N + 1)
return 0;
// product of terms till current
for (i = calculated; i < calculated + current; i++)
cur *= i;
// recursive call for adding terms next in the series
return cur + seriesSum(i, current + 1, N);
}
int main()
{
// input number of terms in the series
int N = 5;
// invoking the function to calculate the sum
printf("%d\n",
// f(n)= (1) + (2*3) + (4*5*6) ... n using recursion
#include <stdio.h>
// Recursive function for finding sum of series
// calculated - number of terms till which sum of terms has
// been calculated
// current - number of terms for which sum has to be
// calculated
// N - Number of terms in the function to be calculated
int seriesSum(int calculated, int current, int N)
{
int i, cur = 1;
// checking termination condition
if (current == N + 1)
return 0;
// product of terms till current
for (i = calculated; i < calculated + current; i++)
cur *= i;
// recursive call for adding terms next in the series
return cur + seriesSum(i, current + 1, N);
}
int main()
{
// input number of terms in the series
int N = 5;
// invoking the function to calculate the sum
printf("%d\n",
Similar questions
Economy,
8 months ago
Physics,
8 months ago
English,
8 months ago
Science,
1 year ago
Psychology,
1 year ago