Q:

Calculate Perfect Square using Java

0

This Program is used to calculate Perfect Square using Java

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

// 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); 

} 
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now