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.
OK, so here it is:
import java.lang.Math;
import java.util.Scanner;
public class Square
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("Please enter a number to be processed:");
double num = input.nextInt();
if((Math.sqrt(num) * 10) % 10 == 0.0)
{
System.out.println("Is a square!");
}
else
{
System.out.println("Is not a square.");
}
}
}
:/ Just square root the number with a calculator. If it isn't "just" a number, then its not a perfect square.
#include <stdio.h> #include <math.h> int main(void) { int number; double result; printf ("\n Introduce an integer: "); scanf ("%i", &number); result= sqrt (number); if ((result * result)== number) printf ("\n The integer HAS a perfect square \n\n"); else printf ("\n The integer DOES NOT HAVE a perfect square \n\n"); getch (); } Shrikanth Ganure The Oxford College of Engineering (MCA-2010 Batch) Bangalore..
write a vb program to find the magic square
It should not be even (except for 2), and must not be dividable with any odd number between 3 and its square-root.
class Abc { public static void main(String[] args) { System.out.println("Hello World!"); } }
write a program that reads in the size of the side of square and then pints a hollow square of that size out of asterisks and blanks?
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.
If the whole number is a perfect square, its square root is rational. If not, it's not.
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".
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
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.
If by 'perfect number' you mean 'perfect SQUARE', then yes. 49 is an odd number and a perfect square.
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.
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.
20 is a not perfect square.
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.
It is the definition of a perfect square.
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.)