Computer Science, asked by anindita46, 1 year ago

wap to accept a number and check whether the number is a perfect sqaure or not.

Answers

Answered by snehalcastelino
0
Using which programming language... please specify
Answered by shivijain2003
2

// Finding whether a number is a perfect square number in Java

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

public class PerfectSquareNumber {


     

   public static void main(String[] args) throws IOException{


       BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));


       System.out.print("Please enter an integer : ");


       int number = Integer.parseInt(reader.readLine());


         


       int sqrt = (int) Math.sqrt(number);


       if(sqrt*sqrt == number) {


           System.out.println(number+" is a perfect square number!");


       }

else {



           System.out.println(number+" is NOT a perfect square number!");


       }


         


   }


}

Hope this helps :)

do mark as brainliest

Similar questions