Write a c program for sum of first n terms of the series
S = 1 - (1/3) + (1/5) -(1/7) + (1/9) ......
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / 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 |
what is computer
what does keyword ‘extern’ mean in a function declaration?
what is the first address that gets stored in stack according to a C or C++ compiler???? or what will be the first address that gets stored when we write a C source code????????
#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++j); printf("%d %d %d", i,j,k); } what will the values of i , j and k? }
14 Answers CDAC, GATE, NDS, TCS,
c programming of binary addition of two binary numbers
What are the types of data structures in c?
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
What do you mean by dynamic memory allocation in c? What functions are used?
how to add two numbers without using arithmetic operators?
Why is c used in embedded systems?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it
5 Answers ABS, Accenture, HCL, Infosys, Infotech, SoftSolve, Software India, TCS, Vertex, Vimukti Technologies,
what is the different bitween abap and abap-hr?