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 many types of sorting are there in c?
What is keyword in c?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
Explain the use of keyword 'register' with respect to variables.
f() { int a=2; f1(a++); } f1(int c) { printf("%d", c); } c=?
wat are the two methods for swapping two numbers without using temp variable??
What is getche() function?
How Many Header Files in c?
Explain what’s a signal? Explain what do I use signals for?
What are the types of data files?
Write code for finding depth of tree
How can I call fortran?