Write a program for the following series:
1*3*5-2*4*6+3*5*7-4*6*8+.................up to nterms
Answer Posted / y hussain reddy
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int i,p,n;
long s=0;
puts("nter n\n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{p=pow(-1,i-1);
s+=i*(i+2)*(i+4)*p;
}
printf("ans=%ld",s);
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain high-order bytes.
Why is structure padding done in c?
What do header files do?
What is structure pointer in c?
What is unary operator?
What is the purpose of void in c?
What are nested functions in c?
What is the scope of local variable in c?
What are the different categories of functions in c?
Where in memory are my variables stored?
What is the scope of an external variable in c?
What are multibyte characters?
Explain what is the advantage of a random access file?
Explain how do you print only part of a string?
What does static variable mean in c?