master
Ozhao 4 years ago
parent a8669e8385
commit 692b0fc575

@ -1,25 +1,9 @@
import java.util.Scanner;
public class zhishu {
public class duishu {
public static void main(String args[]) {
double x,k=1,f=1,e,n,a=0;
Scanner sc = new Scanner(System.in);
x=sc.nextDouble();
n=sc.nextDouble();
if(n < 0)
System.out.println("error");
else
{
for(int i = 1;i <= n;i++)
{
a =Math.pow((double)x,(double)i);
k = k*i;
e = a/k;
f += e;
}
System.out.println((double)f);
}
public double zhishu(double a) {
return Math.pow(Math.E,a);
}
}
}

@ -1,26 +0,0 @@
import java.util.Scanner;
public class duishu {
public static void main(String args[]) {
double x,k=1,f=1,e,n,a=0;
Scanner sc = new Scanner(System.in);
x=sc.nextDouble();
n=sc.nextDouble();
if(n < 0)
System.out.println("error");
else
{
for(int i = 1;i <= n;i++)
{
a =Math.pow((double)x,(double)i);
k = k*i;
e = a/k;
f += e;
}
System.out.println((double)f);
}
}
}
Loading…
Cancel
Save