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
Math,
7 months ago
Computer Science,
7 months ago
Social Sciences,
7 months ago
Hindi,
1 year ago
Chemistry,
1 year ago
Social Sciences,
1 year ago
Math,
1 year ago
Math,
1 year ago