# Java Program to Find Sum of the Series 1/1! + 2/2! + 3/3! + ……1/N!

This is a Java Program to Find Sum of the Series 1/1! + 2/2! + 3/3! + …N/N!.

Enter the number of terms you want in the series as input. Now we use loops and factorials to calculate the sum and get the desired result.

Here is the source code of the Java Program to Find Sum of the Series 1/1! + 2/2! + 3/3! + …N/N!. The Java program is successfully compiled and run on a Windows system. The program output is also shown below.

1. `import java.util.Scanner;`
2. `public class Sum_Series `
3. `{`
4. `    public static void main(String[] args) `
5. `    {`
6. `        double sum = 0;`
7. `        int n;`
8. `        System.out.println("1/1! + 2/2! + 3/3! + ..N/N!");`
9. `        Scanner s = new Scanner(System.in);`
10. `        System.out.print("Enter the no. of terms in series:");`
11. `        n = s.nextInt();`
12. `        Sum_Series obj = new Sum_Series();`
13. `        for(int i = 1; i <= n; i++)`
14. `        {`
15. `            sum = sum + (double)i / (obj.fact(i));`
16. `        }`
17. `        System.out.println("Sum of series:"+sum);`
18. `    }`
19. `    int fact(int x)`
20. `    {`
21. `        int mul = 1;`
22. `        while(x > 0)`
23. `        {`
24. `            mul = mul * x;`
25. `            x--;`
26. `        }`
27. `        return mul;`
28. `    }`
29. `}`

Output:

```\$ javac Sum_Series.java
\$ java Sum_Series

1/1! + 2/2! + 3/3! + ..N/N!
Enter the no. of terms in series:5
Sum of series:2.708333333333333```

Sanfoundry Global Education & Learning Series – 1000 Java Programs.