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