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 structure packing in c?
Does free set pointer to null?
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
What is meant by recursion?
what does keyword ‘extern’ mean in a function declaration?
how many argument we can pas in in a function
How can I insert or delete a line (or record) in the middle of a file?
Synonymous with pointer array a) character array b) ragged array c) multiple array d) none
Which is better malloc or calloc?
#include<stdio.h> void main() { int a=5,b=6,c; int x=(a<b)+7; int y=(x==7)*9; int z=(c=x+y)*2; printf("%h %h %h",x,y,z); } What is the output? Explain it.
What is assert and when would I use it?
What does %f mean c?