Computer Science, asked by PratikRudy, 1 year ago

Find the sum of following series using methods in java program:
1+1/2+1/3+1/4+1/5

Answers

Answered by Kunal777
4
public class Series
{
public static void main(String args[ ])
{
int a;
for(a=1;a<=5;a++)
{
s = s + 1/a;
}
System. out. println(" The sum of the series= " +a);
}
}

Kunal777: pls mark my answer as brainliest
Kunal777: please mark it i need the brainliest mark urgently
PratikRudy: how to mark?
PratikRudy: Ok. I reported it.
akshisaha06: Thanks A Lot !!!!
Answered by kakakakakkasfdg
2
class Sumofseries
{
public static void main(String args[ ])
{
int a;
for(a=1;a<=5;a++)
{
s = s + 1/a;
}
System. out. println(" The sum of the series= " +a);
}
}
Similar questions