64 584
Assignments Done
99,2%
Successfully Done
In September 2018

Answer to Question #16609 in Action Script | Flash | Flex | ColdFusion for DAVID

Question #16609
write a program to write each term of sequence 1^x-2^x+3^x............25^x. The value of n will be entered from a keyboard(cin)
Expert's answer
#include <stdio.h>
#include <stdlib.h>

int main ()
{
int n;
double x=5;
printf("Enter n");
scanf("%d",&n);
double sum=0;
for (int i=1; i<n; i++){
if(i%2==0){
sum+=i/x;
}else{
sum-=i/x;
}

}
printf ("Sum= %.2f ",sum);
scanf("%d",&n);
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions