Computer Science, asked by khulud, 1 year ago

S=1+(1*2)+(1*2*3)+.........(1*2*3*4*5*...........20)
write a program to solve this in java language

Answers

Answered by ShivaniK123
7
public class Series  
{
 public static void main(String[] args) 
 {
  int sum = 0, i = 0;
  for (int j = 1; j <= 20; j++) 
  {
   for (i = 1; i <= j; i++) 
   {
    sum = sum + i;
   }
   i = 1;
  }
  System.out.println("Sum of series = " + sum);
 }
}
Answered by od935432
2

public class Series  

{

public static void main(String[] args)  

{

 int sum = 0, i = 0;

 for (int j = 1; j <= 20; j++)  

 {

  for (i = 1; i <= j; i++)  

  {

   sum = sum + i;

  }

  i = 1;

 }

 System.out.println("Sum of series = " + sum);

}

Similar questions