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 return value (status code) of exit() function.... what the arguments(integer value) passed to it means....

1 Answers   TCS,


What is array of pointers to string?

0 Answers  


in which language c language is written?

2 Answers  


2. Write a function called hms_to_secs() that takes three int values&#8212;for hours, minutes, and seconds&#8212;as arguments, and returns the equivalent time in seconds.. Create a program that exercises this function by repeatedly obtaining a time value in hours, minutes, and seconds from the user (format 12:59:59), calling the function, and displaying the value of seconds it returns.

5 Answers   TCS,


what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; }

3 Answers   Honeywell,






main() { int a=0; if(a=0) printf("Ramco Systems\n"); printf("India\n"); } output?

7 Answers   Ramco,


what is use of loop?

10 Answers   Infosys,


write a program fibonacci series and palindrome program in c

0 Answers   Aditi Placement Service,


What is a const pointer?

0 Answers  


How can I pad a string to a known length?

0 Answers  


What's the best way of making my program efficient?

0 Answers   Celstream,


main() {int i=5; // line 1 i=(++i)/(i++); // line 2 printf("%d",i); // line 3 } output is 2 but if we replace line 2 and line 3 by printf("%d",i=(++i)/(i++)); then output is 1. Why?

1 Answers   GATE,


Categories