-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfor36.java
More file actions
32 lines (26 loc) · 606 Bytes
/
for36.java
File metadata and controls
32 lines (26 loc) · 606 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
package fori;
import java.util.Scanner;
public class for36 {
public static void main(String[] args) {
int n;
int k;
Scanner scanner=new Scanner(System.in);
System.out.print("N:");
n = scanner.nextInt();
System.out.print("K:");
k = scanner.nextInt();
int i2;
float rez = 0F;
float nk;
for (int i = 1; i <= n; ++i)
{
nk = i;
for (i2 = 1; i2 <= k; ++i2)
{
nk *= i;
}
rez += nk;
}
System.out.print(rez);
}
}