Write a program for the following series:
1*3*5-2*4*6+3*5*7-4*6*8+.................up to nterms
Answer Posted / sanath
#include <iostream.h>
void main()
{
int nTerm;
int x=1,y=3,z=5,mul1,total=0;
cout<<"Enter the NTerm:";
cin>>nTerm;
for(int i=1;i<=nTerm;i++)
{
mul1 = ((x++)*(y++)*(z++));
if(i%2)
total = total + mul1;
else
total = total - mul1;
}
cout<<"RESULT:"<<total<<endl;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none
What is array within structure?
What does typedef struct mean?
why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above
Explain modulus operator.
What are the types of bitwise operator?
What is formal argument?
Difference between linking and loading?
What is the c value paradox and how is it explained?
What is c system32 taskhostw exe?
Which is better between malloc and calloc?
Is fortran still used today?
Write a program to find factorial of a number using recursive function.
What is the explanation for cyclic nature of data types in c?
program to convert a integer to string in c language'