package com.company; import java.text.DecimalFormat; import java.util.Scanner; public class Main { public static void main(String[] args) { // write your code here Scanner sc=new Scanner(System.in); int N=sc.nextInt(); double sum=0; DecimalFormat df=new DecimalFormat("0.000000"); for(int i=1;i<=N;i++){ double id=Double.valueOf(i); sum=sum+1/(2*id-1); } System.out.println("sum = "+df.format(sum)); } }