Computer Science, asked by vaanyamittal2006, 1 day ago

wrte a program in java to print 1^1+ 2^2+ 3^3+ --------------------------------- N terms​

Answers

Answered by samarthkrv
0

Answer:

import java.util.Scanner;

import java.lang.Math;

public class Main

{

public static void main(String[] args) {

 Scanner sc = new Scanner(System.in);

 int n = sc.nextInt();

 double sum = 0;

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

         sum = sum + Math.pow(i,i);

     }

     System.out.println((int)sum);

}

}

Explanation:

Mark as brainliest

Similar questions