Home > database >  Sequence and
Sequence and

Time:11-07

#include
Int main ()

{
double sum=0;
Double the item;
int i,n;
The scanf (" % d ", & amp; N);
for(i=1; i<=n; I +=2)
{
The item (I + 1)=I * * (I + 2);
The sum +=item;
}
Printf (" % ld ", sum);
return 0;

}

CodePudding user response:

Why ask not to come out???

CodePudding user response:

Program, calculate the following sequence first n and an odd number of items in the series in the form of: 3 + 1 * 2 * 2 * 3 * 4 + 5 + 3 * 4 *... + n * (n + 1) * (n + 2) +... , prompt accumulative
Enter

Only a set of data input, on one line from the keyboard input the value of n (n<100),
The output

CodePudding user response:

Try this
for(i=1; i<=n; i++)

CodePudding user response:

#include
Int main ()
{
Int sum;
Int item=0;
Int I, b=0, n.
The scanf (" % d ", & amp; N);
for(i=1; i<=n; I +=2)
{
B=b + item;
The item (I + 1)=I * * (I + 2);
Sum=item + b;
}
Printf (" % ld ", sum);
return 0;
}
  • Related