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
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
Explain what is wrong in this statement?
Why does not c have an exponentiation operator?
Give the rules for variable declaration?
What is c definition?
Who developed c language and when?
difference between native and cross compilers
What is the purpose of ftell?
What is difference between array and structure in c?
What is structure of c program?
Explain what are preprocessor directives?
What does return 1 means in c?
Explain the difference between ++u and u++?
Can the sizeof operator be used to tell the size of an array passed to a function?
"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks