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

how can i include my own .h file EX:- alex.h like #include<alex.h>, rather than #include"alex.h"

1 Answers  


class foo { public: static int func(const char*& p) const; }; This is illegal, why?

8 Answers   Google,


what wud be the output? main() { char *str[]={ "MANISH" "KUMAR" "CHOUDHARY" }; printf("\nstring1=%s",str[0]); printf("\nstring2=%s",str[1]); printf("\nstring3=%s",str[2]); a)string1=Manish string2=Kumar string3=Choudhary b)string1=Manish string2=Manish string3=Manish c)string1=Manish Kumar Choudhary string2=(null) string3=(null) d)Compiler error

9 Answers   Infosys,


what are advantages of U D F?

1 Answers   Google,


c program to manipulate x=1+3+5+...+n using recursion

2 Answers   Wipro,


What is the correct declaration of main?

0 Answers  


what is pointer

1 Answers   TCS,


How can you call a function, given its name as a string?

0 Answers  


Why array is used in c?

0 Answers  


what is difference between ++(*p) and (*p)++

17 Answers   Accenture, HCL, IBM,


1 232 34543 4567654 can anyone tell me how to slove this c question

6 Answers  


What's the right way to use errno?

0 Answers  


Categories