Recent Posts
Erlang | 9 sec ago
None | 51 sec ago
None | 58 sec ago
None | 1 min ago
VeriLog | 2 min ago
None | 2 min ago
None | 3 min ago
None | 3 min ago
None | 3 min ago
None | 3 min ago
Cool Sites
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
By Anonymous on the 1st of May 2010 03:54:06 PM
Download |
Raw |
Embed |
Report
package parouimpar;
import javax.swing.*;
public class Main {
public static void main(String[] args) {
Object[] op = {"Sim", "Não"};
int i, o;
String str;
while(true)
{
str = JOptionPane.showInputDialog(null, "Entre com o número: ", "Número", JOptionPane.QUESTION_MESSAGE);
if(str.equalsIgnoreCase("Sair"))
{
o = JOptionPane.showOptionDialog(null, "Tem certeza que deseja sair?", "Sair", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, null, op, op[1]);
if(o == 0)
{
break;
} else {
continue;
}
}
i = Integer.parseInt(str);
if(i%2 == 0)
{
JOptionPane.showMessageDialog(null, "O número " + i + " é par.", "PAR", JOptionPane.PLAIN_MESSAGE);
} else
{
JOptionPane.showMessageDialog(null, "O número " + i + " é impar.", "IMPAR", JOptionPane.PLAIN_MESSAGE);
}
}
}
}
Submit a correction or amendment below.
[ previous version ] | [ difference ] | Make A New Post