import java.io.*; class harmonicSeries { public static void main(String args[]) { int i,n; String s; double sum=0; try{ System.out.println(\"=====HARMONIC SERIES=====\"); System.out.print(\"Enter value of n : \"); System.out.flush(); BufferedReader ob1 = new BufferedReader(new InputStreamReader(System.in)); s=ob1.readLine(); n=Integer.parseInt(s); while(n>0) { sum=sum+(1.0/n); n--; } System.out.println(\"Sum of Harmonic Series for value \\\"\"+s+\"\\\" is : \"+ sum); } catch (Exception e) {} } }