x0= 4- (e^4 -4)/(e^4-1) write me a java program do this and put it in a loop when calculate x0 calculate for x1= the result of x0 be at the spot of the four this time the same equation instead x1= 4- (e^the result -result)/e^theresult -1)
import java.util.Scanner; public class TestCode { public static void main(String args[]){ double x = 4; double res; Scanner scanner = new Scanner(System.in); System.out.print("Enter number of terms: "); int n = scanner.nextInt(); for(int i = 1;i<=n;i++){ res = 4 - (Math.exp(x)-x)/(Math.exp(x) - 1); System.out.println("x"+(i)+" = "+res); x = res; } } }
Get Answers For Free
Most questions answered within 1 hours.