Monday, September 13, 2021

A program that reads an integer that is typed in by the * user and computes and prints the square of that integer.


/*
* A program that reads an integer that is typed in by the
* user and computes and prints the square of that integer.
*/

import java.util.Scanner;
public class BSIT
{
public static void main(String[] args)
{
Scanner readme = new Scanner(System.in);

int userinput; // The number input by the user.
int compute; // The userInput, multiplied by itself.

System.out.print("Please type a number: ");
userinput = readme.nextInt();
compute = userinput * userinput;
System.out.print("The square of that number is ");
System.out.println(compute);


}

}






























No comments:

Post a Comment

Contact Us

Contact Form

Name

Email *

Message *