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
What are derived data types in c?
What is a null pointer in c?
What is the difference between volatile and const volatile?
Explain what is the concatenation operator?
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
why do some people write if(0 == x) instead of if(x == 0)?
C language questions for civil engineering
How can I insert or delete a line (or record) in the middle of a file?
What are different types of operators?
What is a union?
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
What is openmp in c?
What is a function simple definition?
Why do we use null pointer?
What is union in c?