Task: | Loops |
Sender: | jeroenrobben |
Submission time: | 2018-09-13 00:30:08 +0300 |
Language: | Java |
Status: | COMPILE ERROR |
Compiler report
input/loops.java:3: error: class Loops is public, should be declared in a file named Loops.java public class Loops { ^ 1 error
Code
import java.util.Scanner; public class Loops { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); System.out.println(calculate(n)); scan.close(); } public static long calculate(int n) { return (long) ( (Math.pow(n, 3) / 6.0 ) + (Math.pow(n, 2) / 2.0 ) + ( n/ 3.0 ) ); } }