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


Please Help Members By Posting Answers For Below Questions

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

631


Explain what is wrong in this statement?

632


Why does not c have an exponentiation operator?

629


Give the rules for variable declaration?

674


What is c definition?

743






Who developed c language and when?

584


difference between native and cross compilers

1671


What is the purpose of ftell?

599


What is difference between array and structure in c?

578


What is structure of c program?

603


Explain what are preprocessor directives?

627


What does return 1 means in c?

583


Explain the difference between ++u and u++?

636


Can the sizeof operator be used to tell the size of an array passed to a function?

620


"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

656