You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
p6hsylpbf/a.java

25 lines
381 B

4 years ago
package e<EFBFBD><EFBFBD>x<EFBFBD>η<EFBFBD>;
public class power{
public static int factorial(int n){
int factorial=1;
int counter=1;
while (counter<1+n){
factorial*=counter+1;
counter++;
}
return factorial;
}
public static double ex(int n,int x){
double ex=1.0;
int counter=1;
while (counter<=n){
ex+=(double)Math.pow(x,counter)/factorial(counter);
counter++;
}
return ex;
}
}