Java Quiz (2): Show your java strength : ********Result**********
28 views
Skip to first unread message
Kamlesh Paunikar
unread,
Oct 6, 2009, 6:15:42 AM10/6/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Code Gurukul
Hello All
Complete code should not use if-else or loop it should use
only switch case statement.
Here is the code...
/**
*
* @author Kamlesh Paunikar
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int n = -34; //Test your any integer number here
switch (n) {
case 0:
System.out.println("Zero");
break;
default:
int check = n / Math.abs(n);
switch (check) {
case 1:
System.out.println("+ve");
break;
case -1:
System.out.println("-ve");
break;
}
}
}
}
Now ready for the next simmmmmmmmmmmmmple question............