Computer Science, asked by vasanthij97, 1 year ago

s= 1+1/2+1/3+1/4+1/5+…+1/10
what's the coding for this series program?

Answers

Answered by Anonymous
13
⭐ ICSE BLUE-J PROGRAMMING [JAVA] ⭐


import java.util.*;
public class Series
{
public static void main(String args[ ])
{
Scanner in=new Scanner(System.in);
int a,b;
double s=0;
for(a=1;a<=10;a++)
{
int f=1;
for(b=1;b<=a;b++)
{
f=f*b;
}
s=s+(double) 1/f;
}
System.out.println("The sum of the series ="+s) ;
}
}
Answered by rachitsainionline
1

⭐ ICSE BLUE-J PROGRAMMING [JAVA] ⭐



import java.util.*;

public class Series

{

public static void main(String args[ ])

{

Scanner in=new Scanner(System.in);

int a,b;

double s=0;

for(a=1;a<=10;a++)

{

int f=1;

for(b=1;b<=a;b++)

{

f=f*b;

}

s=s+(double) 1/f;

}

System.out.println("The sum of the series ="+s) ;

}

}


Read more on Brainly.in - https://brainly.in/question/6255947#readmore

Similar questions