generate the following series upto terms in java or bluej 1,4,7,10....
Answers
Answered by
0
import java.util. *;
class series
{
public static void main ()
{
Scanner sc = new Scanner System.in ( )
System.out.println("Enter the number of terms");
int n=sc.nextInt ( );
int a,sum=0;
for (int i=1;i <=n;i++)
{
sum=sum+a;
a+=3
}
System.out.println(sum );
}
}
Similar questions
Math,
7 months ago
Computer Science,
7 months ago
English,
1 year ago
Math,
1 year ago
Math,
1 year ago