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