Computer Science, asked by kritika2727, 1 year ago

write a program in java using for loop to print following series

Attachments:

Answers

Answered by Rajdeep11111
3
import java.io.*;
class Series
{
public static void main (String args[])
{
BufferedReader buff = new BufferedReader (new InputStreamReader(System.in));
int a = 2, n, i;
double term = 0.0, sum = 0.0;
System.out.print("Enter the number of
terms: ");
n = Integer.parseInt(buff.readline());
for (i = 0; i <= n; i++)
{
term = term + (1/a);
sum = sum + term;
a += 2;
}
System.out.println(" Sum of the series
is: " + sum);
}
}

Please follow to get more answers!!

kritika2727: Thanks but I need it with a buffered reader
Rajdeep11111: all are same..ok wait
kritika2727: waiting
Rajdeep11111: ok?
Rajdeep11111: now please follow me (if u want)
kritika2727: Please solve and send
Rajdeep11111: sent already....check
kritika2727: thanks
Rajdeep11111: ok..my pleasure!!
kritika2727: it is some what different from which patterns of writing I have
Similar questions