Answers

2015-03-20T21:58:36+05:30
Import java.io.*;
class JAVA
{
  public static void main()throws IOException
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    System.out.print("Enter your limit for the series- ");
    int n=Integer.parseInt(br.readLine());
    int r=0,d=0,S=0,k;
    for(int i=1,k=2;i<=n;++i,++k)
    {
      if(k%2==0)
      {
        r=r+(1/k);
      }
      if(k%2!=0)
      {
       d=d-(1/k);
      }
      S=S+(r+d);
    }
    System.out.println("Sum of the series= "+S);
  }
0