write a program in java to print 1+4+27.... N terms
Answers
Answered by
0
Answer:
import java.util.Scanner;
class series
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter number of terms");
int n=sc.nextInt();
int sum=0;
for(int i=1;i<=n;i++)
{
sum=sum+(int)Math.pow(i,i);
}
System.out.println("Sum of series="+sum);
}
}
Similar questions
Math,
3 months ago
Chemistry,
3 months ago
Math,
3 months ago
Math,
7 months ago
India Languages,
7 months ago
Chemistry,
11 months ago
English,
11 months ago
Accountancy,
11 months ago