Java program to find Perfect square of a number

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        int n;

        Scanner s=new Scanner(System.in);

        System.out.println("Enter the number:");

        n=s.nextInt();

        double m= Math.sqrt(n);

        if(m*m==n)

            System.out.println("The given number is perfect square");

         else

            System.out.println("The given number is not perfect square");

    }

}


Comments

Popular Posts