Java

Calculate Perfect Square using Java

Calculate Perfect Square using Java
// perfect square 

import java.io.*; 

class ssvps 
{ 
public static void main(String arg[]) throws IOException 
{ 
String s1; 

int m,n; 

int p; 

DataInputStream dr = new DataInputStream(System.in); 

System.out.print("\nEnter the Number : "); 

s1 = dr.readLine(); 

n = Integer.parseInt(s1); 

p=(int)sqrt(n); 

m = p; 

if(p == m) 

System.out.println("\nit is Perfect Square"+n); 

else 

System.out.println("\nit is Not Perfect Square"+n); 

} 
}
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.