exp(x) fortran

In Fortran, the exp(x) function is used to calculate the exponential value of x. The exp(x) function returns the exponential value of x, where x is a real or complex number. Here is an example code snippet showing how to use the exp(x) function in Fortran:

program exponential_example
  real :: x, result

  ! Assign a value to x
  x = 2.0

  ! Calculate the exponential value of x
  result = exp(x)

  ! Print the result
  print *, "The exponential value of", x, "is", result
end program exponential_example

In this example, the program assigns the value 2.0 to the variable x. It then uses the exp(x) function to calculate the exponential value of x, and stores the result in the variable result. Finally, it prints the value of result.

You can modify the value of x to calculate the exponential value for different numbers. Remember to include the use, intrinsic :: iso_fortran_env statement at the beginning of your code if you are using a Fortran version older than Fortran 2008, as the exp() function is part of the intrinsic module.