Write a program to find the sum of the following series
a)
X+2x+3x+4x+.
...nx.
Answers
Answered by
0
Answer:
import java.util.*;
class series
{
public static void main()
{
Scanner sc= new Scanner(System.in);
int I,n,x,s=0;
System.out.println("Enter the ending amount of loop:");
n=sc.nextInt();
for(i=1;i<=n;i++)
{
s=s+i*x;
}
System.out.println("Sum of the series"+s);
}
}
Similar questions