Java Program To Find the exponential of a number.
public class Exponential {
public static void main(String[] args) {
double x = Double.parseDouble(args[0]);
double sum = 0.0;
double term = 1.0;
for (int i = 1; sum != sum + term; i++) {
sum = sum + term;
term = term * x / i;
System.out.println(i + " " + term + " " + sum);
}
System.out.println(sum);
System.out.println(Math.exp(x));
}
}
Loading...
|
Comments :
Post a Comment