Blogger Tips and TricksLatest Tips And TricksBlogger Tricks

Program to Find the Exponent of a N in python


"Program to Find the Exponent of a N"
import math
def exponential(n,x):
     sum = 1
     for i in range(n-1,0,-1):
        sum = 1 + x * sum / i
     return sum
def main():
        n = int(input("Enter the length of Series (10 is Normal): "))
        x = int(input("Enter the Number:  "))
        print ("e^x =", exponential(n,x))
        print ("Value give by math function ",math.exp(x))
main()

No comments:

Post a Comment

Flag Counter