How to Write Java Program That Sum 1+x/1!+x^2/2!+x^3/3?

1

1 Answers

Liam Rudge Profile
Liam Rudge answered
First 1! & 2! Looks like your after the factorial which the factorial 1! Is 1 and the factorial of 2! Is 2 so just swap these numbers with 1 and 2 as shown below the code you need to write has been bolded for you. You must be using java.lang.math to bring in the ^ function  int x; <-- declare this to hold the value of x    int sum; <-- declare this to hold the value of the sum in total  sum = (1 + (x/1) + (pow(x,2)/2) + (pow(x,3)/3));

Answer Question

Anonymous