Untitled
unknown
java
a year ago
332 B
11
Indexable
import java.util.Scanner;
public class P1 {
public static float Sol(int n) {
float s = 0;
for (int i = 1; i <= n; i++)
s += (i * 1.0) / (i + 1);
return s;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
System.out.println(Sol(n));
}
}Editor is loading...
Leave a Comment