Pls answer this question !!! I'll mark as brainlist
No spam pls!!!
Write a program in Java to find the sum of given series
1+(2^2)/a+(3^3)/(a*a).......................................................to n terms
Answers
Answered by
1
Explanation:
public static void main(String[] args) {
Scanner scn=new Scanner(System.in);
int n=scn.nextInt(), sum=0;
for(int i=1; i<=n; i++) sum+=fact(i);
System.out.println(sum);
}
Answered by
5
Answer:
$import \: java.util.^* \: ;$
Explanation:
The logic was very simple. You have to just do this:
$\dfrac{i^i}{a^(i-1)}$ until n terms
So, you have to just take the value of n and a from the user and substitute value a and n in the place of a and n in the program.
Similar questions