Pages

Saturday

Program to Calculate the Exponential Series in C | C Program

Here's a C program to calculate the exponential series using For loop with output.

Formula of Exponential Series: The formula for sine series is -

Exponential Series

# include <stdio.h>
# include <conio.h>
void main() 
{ 
 int i, n, exp; 
 float x, sum = 1, t = 1 ; 
 clrscr() ; 
 printf("Enter the value for x : ") ; 
 scanf("%f", &x) ; 
 printf("\nEnter the value for n : ") ; 
 scanf("%d", &n) ; 
 for(i = 1 ; i < n + 1 ; i++) 
 { 
  exp = i ; 
  t = t * x / exp ; 
  sum = sum + t ; 
 } 
 printf("\nExponential Value of %f is : %8.4f", x, sum) ; 
 getch() ; 
}

Output of above program is

Enter the value for x : 2
Enter the value for n : 20
Exponential Value of 2.000000 is :   7.3891

9 comments:

  1. Very good logic!! Program is working correctly!!

    ReplyDelete
    Replies
    1. Sirr i need this program as atleast 13 page did u make u sirr

      Delete
  2. wrong code. power function not used. neither factorial is calculated

    ReplyDelete
  3. Hello There,


    Fully agree on C Programming Tutorial. We’re seeing a lot of projects tackle big complex problems but few seem to have taken into consideration and in particular reasons to adopt.

    Could someone explain how to write a function to access and display head node in a one node linked list only? I am learning linked list of my own and I am stuck there. Can someone explain it urgently?

    I read multiple articles and watched many videos about how to use this tool - and was still confused! Your instructions were easy to understand and made the process simple.

    Regards,
    David

    ReplyDelete