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 is struct node in c?

621


What is the importance of c in your views?

596


printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions

636


What is the difference between char array and char pointer?

527


C language questions for civil engineering

1245






write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

3190


How can I find out how much free space is available on disk?

629


What is data structure in c and its types?

596


What are static variables in c?

629


What is an array? What the different types of arrays in c?

660


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2413


how can I convert a string to a number?

597


This is a variation of the call_me function in the previous question:call_me (myvar)int *myvar;{ *myvar += 5; }The correct way to call this function from main() will be a) call_me(myvar) b) call_me(*myvar) c) call_me(&myvar) d) expanded memory

733


What are the applications of c language?

626


What are integer variable, floating-point variable and character variable?

609