Untitled
unknown
java
a year ago
414 B
3
Indexable
import java.util.Scanner; public class P1 { public static float Sol(int n, int x) { float sum = 0; for (int i = 1; i <= n; i++) { sum = (float) Math.sqrt(sum + Math.pow(x, i)); } return sum; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int x = sc.nextInt(); System.out.println(Sol(n, x)); // Sol(n); } }
Editor is loading...
Leave a Comment