Math, asked by kaish4334, 9 months ago

write a program in java to find the sum of the series 26-16+36-26+46-36+56....n

Answers

Answered by Dhruvraaj
1

86 is the answer of this question

=

Answered by piyushdas2004
1

Answer:

Java Program super simple and easy to understand mark this as the

Step-by-step explanation:

public class d_series

{

   public static void main(int n)

   {

       int t=26,sum=0;

       int r;

       for(int i=1;i<=n;i++)

       {

           if(i%2!=0)

           {

               System.out.print(" "+t);

              r=10;

               t=t-r;

               sum=sum+t;

           }

           else

           {

               System.out.print(" "+t);

               r=20;

               t=t+r;

                sum=sum+t;

               }

           }

           System.out.print(" The sum of the series is "+sum);

       }

   }

               

Similar questions