How To Write a C Program for Exponent Series in C Programming Language ?
A program to evaluate the power series
x2 x3 xn ex = 1 + x + --- + --- + ..... + ---- , 0 < x < 1 2! 3! n!
It uses if……else to test the accuracy.
The power series contains the recurrence relationship of the type
If Tn-1 (usually known as previous term) is known, then Tn (known as present term) can be easily found by multiplying the previous term by x/n. ThenTn = Tn-1 (---) for n > 1 T1 = x for n = 1 T0 = 1
ex = T0 + T1 + T2 + ...... + Tn = sum
Solution For C Program for Exponent Series:
#include<stdio.h> #define ACCURACY 0.0001 main() { int n, count; float x, term, sum; printf("Enter value of x:"); scanf("%f", &x); n = term = sum = count = 1; while (n <= 100) { term = term * x/n; sum = sum + term; count = count + 1; if (term < ACCURACY) n = 999; else n = n + 1; } printf("Terms = %d Sum = %fn", count, sum); }Output :Enter value of x:0 Terms = 2 Sum = 1.000000 Enter value of x:0.1 Terms = 5 Sum = 1.105171 Enter value of x:0.5 Terms = 7 Sum = 1.648720 Enter value of x:0.75 Terms = 8 Sum = 2.116997 Enter value of x:0.99 Terms = 9 Sum = 2.691232 Enter value of x:1 Terms = 9 Sum = 2.718279
Tags: C Program for Exponential Series, write a c program to find the exponential series, c program for sine series, c program for cosine series, c program to find sum of exponential series, c program for exponential function, c program for exponential curve fitting, exponential function in c language, write a c program to find the maximum of 3 numbers using functions.
Learn More :
C Program
- Using Bash to input stuff into c program
- Difficult C Programming Questions
- Write a c program to find largest among three numbers using binary minus operator three numbers using binary minus operator
- PRINTING ASCII VALUE USING C PROGRAM
- MULTIPLICATION OF TWO MATRICES USING C PROGRAM
- FIND OUT SUM OF DIAGONAL ELEMENTS OF A MATRIX USING
- Write A C Program To Find Out Transport Of A Matrix
- Factorial of 100 in C Program
- Multiplication of large numbers in c
- Division of Large Numbers in C Program
- BINARY SEARCH USING C PROGRAM
- BINARY SEARCH THROUGH RECURSION USING C PROGRAM
- FIND FACTORIAL OF A NUMBER USING RECURSION IN C PROGRAM
- FIND GCD OF A NUMBER USING RECURSION IN C PROGRAM
- FIND SUM OF DIGITS OF A NUMBER USING RECURSION USING C PROGRAM
- FIND POWER OF A NUMBER USING RECURSION USING C PROGRAM
- REVERSE A NUMBER USING RECURSION IN C PROGRAM
- SWAP TWO VARIABLES WITHOUT USING THIRD USING C PROGRAM VARIABLE
- Write A C Program For Swapping Of Two Arrays
- SWAPPING OF STRINGS USING C PROGRAM
- CONVERSION FROM DECIMAL TO OCTAL USING C PROGRAM
- CONVERSION FROM DECIMAL TO OCTAL USING C PROGRAM
- CONVERSION OF DECIMAL TO BINARY USING C PROGRAM
- CONVERSION OF FAHRENHEIT TO CENTIGRADE USING C PROGRAM
- C or C++ Program To Find Bonus Amount