Write a c program for sum of first n terms of the series
S = 1 - (1/3) + (1/5) -(1/7) + (1/9) ......

Answer Posted / amitabha mukhopadhyay

void main()
{
int i,n,sum;
printf("enter n");
scanf("%d",&n);
for(i=1,i<=n,i++)
{
sum=1;
sum=sum+(-1,i)*1/(2i+1));
printf("sum=%d");
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are different storage class specifiers in c?

616


Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop

1714


What is a dynamic array in c?

594


Is return a keyword in c?

598


write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.

3335






Why do we need arrays in c?

581


What is dynamic variable in c?

565


What is the use of a semicolon (;) at the end of every program statement?

771


What type is sizeof?

585


What is page thrashing?

651


What are c preprocessors?

677


What is a constant?

631


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

620


What is string function in c?

536


What is the explanation for the dangling pointer in c?

676