How to write the following java code using switch case ? Anyone pls tell.
Attachments:
Answers
Answered by
0
U cant use it for this one....u at least need 2 to 3 or more cases to implement it
Answered by
2
class Code2
{
public static void main (String args [])
{
int n=289, r;
r=sqrt(n);
switch(n)
{
case r:
System.out.println("Perfect square");
break;
default:
System.out.println("Not a perfect square");
}
}
}
Similar questions