The value of ex can be computed as the power series
prepare a program that computes ex using this formula. Of course, you can't compute an infinite sum. Just keep adding values until an individual summand (term) is less than a certain threshold. At each step, you need to compute the new term and add it to the total. Update these terms as follows:
term = term * x / n;