How to make a program of series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n! using java programming language

Answers (1)

// Java program to print the sum of series 

import java.io.*; 
import java.lang.*; 

class GFG  
    public static double sumOfSeries(double num) 
     
        double res = 0, fact = 1; 
        for (int i = 1; i <= num; i++)  
            /*fact variable store factorial of the i.*/
            fact = fact * i; 

            res = res + (i / fact); 
         
        return (res); 
     

    public static void main(String[] args) 
     
        double n = 5; 
        System.out.println("Sum: " + sumOfSeries(n)); 
     
 
 

Most Viewed Questions

Preparation Products

Knockout JEE Main April 2021 (One Month)

Personalized AI Tutor and Adaptive Time Table, Self Study Material, Weekend Live Classes, Mentorship from our Experts, Unlimited Mock Tests and Personalized Analysis Reports, 24x7 Doubt Chat Support,.

₹ 14000/- ₹ 4999/-
Buy Now
Knockout NEET Aug 2021 (One Month)

Personalized AI Tutor and Adaptive Time Table, Self Study Material, Weekend Live Classes, Mentorship from our Experts, Unlimited Mock Tests and Personalized Analysis Reports, 24x7 Doubt Chat Support,.

₹ 14000/- ₹ 4999/-
Buy Now
Knockout JEE Main May 2021

Personalized AI Tutor and Adaptive Time Table, Self Study Material, Weekend Live Classes, Mentorship from our Experts, Unlimited Mock Tests and Personalized Analysis Reports, 24x7 Doubt Chat Support,.

₹ 22999/- ₹ 9999/-
Buy Now
Knockout NEET Aug 2021

Personalized AI Tutor and Adaptive Time Table, Self Study Material, Weekend Live Classes, Mentorship from our Experts, Unlimited Mock Tests and Personalized Analysis Reports, 24x7 Doubt Chat Support,.

₹ 22999/- ₹ 9999/-
Buy Now
Test Series JEE Main May 2021

Unlimited Chapter Wise Tests, Unlimited Subject Wise Tests, Unlimited Full Mock Tests, Get Personalized Performance Analysis Report,.

₹ 6999/- ₹ 2999/-
Buy Now
Boost your Preparation for JEE Main with our Foundation Course
 
Exams
Articles
Questions