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



Describe for loop and write a c program to sum the series X + x2/2! + x3 /3! + …….. up to fift..

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

Describe for loop and write a c program to sum the series X + x2/2! + x3 /3! + …….. up to fift..

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

Post New Answer

More C Interview Questions

what is the code to display color fonts in the output?

1 Answers  


Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..

0 Answers   Huawei,


Explain what are compound statements?

0 Answers  


Name the language in which the compiler of "c" in written?

3 Answers   Bajaj,


Which of the following about automatic variables within a function is correct ? a.its type must be declared before using the variable b.they are local c.they are not initialised to zero d.they are global.

6 Answers   FCI, TCS,






program for reversing a selected line word by word when multiple lines are given without using strrev

0 Answers   IBM,


In C language what is a 'dangling pointer'?

0 Answers   Accenture,


What are c header files?

0 Answers  


What's a "sequence point"?

3 Answers  


write a program to find out number of on bits in a number?

17 Answers   Huawei, Microsoft,


a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.

0 Answers  


who will call your main function in c under linux?

2 Answers  


Categories