-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFun45.java
More file actions
43 lines (34 loc) · 842 Bytes
/
Fun45.java
File metadata and controls
43 lines (34 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package fun;
/**
* Project Admin -> Husanboy Azamov
* Package Name -> fun
* Class Date -> 6/21/2022/ 13:30 PM
*/
public class Fun45 {
public static void main(String[] args) {
System.out.println(Power4(3, 5, 6));
}
public static double Power4(double x, double a, double e) {
double s;
double mh;
double kp;
int ayirsh = -1;
double summa = 0;
for (int i = 0; i < e; i++) {
kp = (ayirsh - i + 1);
s = (x * i);
mh = factorial(i);
double bolish = (s / mh);
summa = ayirsh * kp * bolish;
ayirsh *= -1;
}
return summa;
}
public static int factorial(int n) {
int f = 1;
for (int i = 1; i <= n; i++) {
f *= i;
}
return f;
}
}