-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathSimpleMethod2.java
More file actions
22 lines (16 loc) · 662 Bytes
/
SimpleMethod2.java
File metadata and controls
22 lines (16 loc) · 662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.util.Scanner;
public class SimpleMethod2 {
// Put your method code here, takes 1 integer, squares it, returns the integer result of the square.
private static int square(int input) {
return input * input;
}
public static void main(String[] args) {
// Put scanner code to get integer input here
System.out.print("Number to square: ");
int input = new Scanner(System.in).nextInt();
// Modify the below call to assign the result of the method call to a variable.
int output = square(input);
// Put the result System.out code here.
System.out.println(output);
}
}