// Calculate the sum of the series // 1/1+1/2+1/3+...+1/n in rational numbers import java.io.*; import rational; class series { public static void main (String[] args) throws IOException { int n, i; BufferedReader stdin; stdin = new BufferedReader (new InputStreamReader (System.in)); System.out.print ("Enter n: "); n = Integer.parseInt (stdin.readLine()); rational s = new rational (1,1); for (i=2; i<=n; i++) s = s.sum(new rational(1,i)); s.reduce(); System.out.println(s.str()); } }