Computer Science, asked by suhani1234567, 1 year ago

write a program to find the sum of the given series do any one of the parts u know. plzz help me

Attachments:

Answers

Answered by Anonymous
4

(ii)

import java.util.*;

public  class Sum

{

public static void main(String args[])

{

Scanner in= new Scanner(System.in);

int a=0, s=0,i,n;

System.out.println("Enter the value of n");

n=in.nextInt();

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

{

a= a+i;

s=s+a;

System.out.println("The sum of the series is=" +s);

}

}

}

Similar questions