answersLogoWhite

0

Example:

int x, y;

x = 5;

y = x * x; // square of x

System.out.println("The square of " + x + " = " + y);

Put all this in your main() method. Most Java IDEs will generate the main() method automatically.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

How can I tell whether a number is a square number?

You can tell whether a number is a square number by looking at the last digit. A perfect square number ends with either 1, 4, 5, 6, 9 or 00.


How can you tell whether a square root of a whole number is rational or irrational?

If the whole number is a perfect square, its square root is rational. If not, it's not.


What is it called when a number has a whole number square root?

Then the number is called a "perfect square".Then the number is called a "perfect square".Then the number is called a "perfect square".Then the number is called a "perfect square".


How do you know whether a number is a perfect square?

A number is a perfect square when you can directly extract its square root in whole numbers and without approximation. When you subject a certain number to a radical sign, you can extract its square. Example: 25 is a perfect square. it's square root is 5, since 5 x 5 is equal to 25


How do you check if a number is a perfect square?

For a number to be a perfect square, the number's square root has to be a whole number. 9 is a perfect square because its square root is a whole number, 3. If the square root of the number is a decimal, then it is not a perfect square. For example, 13 does not divide evenly so it not a perfect square.


Can a perfect number be odd?

If by 'perfect number' you mean 'perfect SQUARE', then yes. 49 is an odd number and a perfect square.


What number is both a square number and a cube number between 1 and 25?

There is not a number that is a perfect square and perfect cube between 1 and 25.There is not a number that is a perfect square and perfect cube between 1 and 25.There is not a number that is a perfect square and perfect cube between 1 and 25.There is not a number that is a perfect square and perfect cube between 1 and 25.


Is the different of the smallest three digit number and the smallest two digit number is a perfect square?

No. The smallest 2 digit number is 10 the smallest 3 digit number is 100 - so the question is whether (100-10) is a perfect square? No - 90 is not a perfect square. 8x8 is 64 and 9x9 is 91, not 90.


Is the number a perfect square?

20 is a not perfect square.


How do you determine that 72 is not a square number?

You take the square root of the number. If it is a perfect square, this will be a whole number. If it is not, it isn't a perfect square.


Why is a perfect square the square of a whole number?

It is the definition of a perfect square.


Is the number 125 a square number?

Well, technically, it is the square of 11.18033989...but it is not a perfect square(a perfect square is the square of a whole number. 1,4,9,16,25,36,49,64,81,100,121,144,169,196,225,256, etc.)