Describe for loop and write a c program to sum the series
X + x2/2! + x3 /3! + …….. up to fifteen terms.
Answers were Sorted based on User's Feedback
Answer / gouthami chintala
#include<stdio.h>
#include<conio.h>
void main()
{
int sum=0;
int x,i,j,c=1;
printf("enter a value for a x);
scanf("%d",&x);
for(i=1;i<=15;i++)
{
for(j=i;j<=1;j--)
{
c=c*i;
}
sum=sum+(x/c);
}
printf("the value of x+x/2!+x/3!----- for the given x value
is");
printf("%d",sum);
}
| Is This Answer Correct ? | 24 Yes | 15 No |
Answer / sai
#include<math.h>
void main()
{
int i,sum=0,x;
clrscr();
printf("enter x value");
scanf("%d",&x);
for(i=1;i<=15;i++)
sum=sum+((x*i)/fact(i));
printf("sum of x+x2/2!.......x15/15!=%d",sum);
getch();
}
| Is This Answer Correct ? | 10 Yes | 13 No |
How does placing some code lines between the comment symbol help in debugging the code?
1)which of following operator can't be overloaded. a)== b)++ c)?! d)<=
in b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which operation will be performed first a) 6.6/a b) 2*a c) 3*c d) 2/n
what are the static variables
8 Answers HCL, iFlex, TCS, Wipro,
main() { int i = -3,j=2,k=0,m; m= ++i || ++j && ++k; printf("%d%d%d",i,j,k,m); }
Is file a keyword in c?
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?
why we use pointer in c
What is sizeof return in c?
What is the data segment that is followed by c?
What is the advantage of c?
How does C++ help with the tradeoff of safety vs. usability?