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

please give me some tips for the placement in the TCS.

1631


Tell me with an example the self-referential structure?

564


i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none

644


What is c system32 taskhostw exe?

586


Can we compile a program without main() function?

633






Subtract Two Number Without Using Subtraction Operator

355


What are the main characteristics of c language describe the structure of ac program?

606


What does char * * argv mean in c?

623


What is structure pointer in c?

569


What is the benefit of using #define to declare a constant?

602


What is the best way of making my program efficient?

569


what is event driven software and what is procedural driven software?

2015


What is a void pointer in c?

606


what is reason of your company position's in india no. 1.

1775


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

1526