Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- public class series
- {
- public static void main(String args[])throws IOException
- {
- long n;
- DataInputStream obj=new DataInputStream(System.in);
- System.out.println("Enter n");
- n=Integer.parseInt(obj.readLine());
- double bigsum = 0.0;
- for(long j = 1; j <= n; j++) {
- long sum=1, product=1;
- double computedterm;
- for(long i=2; i <= (j + 1) ;i++)
- {
- sum+=i;
- product*=i;
- }
- computedterm = sum * 1.0 / product;
- bigsum += computedterm;
- }
- System.out.println( bigsum );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement