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 / lavanya

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

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is pragma c?

605


Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?

571


Explain union. What are its advantages?

611


Explain what is a const pointer?

632


What is extern keyword in c?

637






what are enumerations in C

718


Where define directive used?

596


What is pointer in c?

731


List out few of the applications that make use of Multilinked Structures?

1284


Explain how can I convert a string to a number?

638


What is the right type to use for boolean values in c? Is there a standard type?

557


What language is c written?

572


Why structure is used in c?

580


What are register variables in c?

569


Explain the concept and use of type void.

619