EchoSquare.java
Here is a program that computes the square of a number that the user enters.
import java.util.Scanner; class EchoSquare { public static void main (String[] args) { Scanner scan = new Scanner( System.in ); int num, square; // declare two int variables System.out.println("Enter an integer:"); num = scan.nextInt(); square = num * num ; // compute the square System.out.println("The square of " + num + " is " + square); } }
Here is a picture of it running:
Do you think that the following input would work with this program?
twelve hundred