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