Saved Bookmarks
| 1. |
Write the program in Java to find the sum of following series: 1+(1+2)/(1×2)+(1+2+3)/(1×2×3) |
|
Answer» import java.util.Scanner; PUBLIC class HelloWorld{ public static void main(String []args) { Scanner sc=new Scanner(System.in); System.out.println("Enter the TERM till you want SUM of series"); int n=sc.nextInt(); int s=0,p=1; double sum=0; for(int i=1;i<=n;i++) { s+=i; p*=i; sum+=(double)s/p; } System.out.println("Sum of series is "+sum); } } Explanation: Hope it helps:-) Mark me brainliest |
|