Your First Method

Lab Java Beginner 10 points

Complete static int square(int x). The starter reads a number and prints square(n).

Input

One integer.

Output

Its square.

Example

Input

7

Output

49
Sample input available Sample output available
Editor
Java

Hints

The return type (int) goes before the method name.

return sends the value back to the caller.

Solution explanation

static methods belong to the class, so main can call them directly.

Show solution
import java.util.Scanner;

public class Main {
    static int square(int x) {
        return x * x;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println(square(sc.nextInt()));
    }
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD