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
  1. package parouimpar;
  2. import javax.swing.*;
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Object[] op = {"Sim", "Não"};
  6.         int i, o;
  7.         String str;
  8.         while(true)
  9.         {
  10.             str = JOptionPane.showInputDialog(null, "Entre com o número: ", "Número", JOptionPane.QUESTION_MESSAGE);
  11.             if(str.equalsIgnoreCase("Sair"))
  12.             {
  13.                 o = JOptionPane.showOptionDialog(null, "Tem certeza que deseja sair?", "Sair", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, null, op, op[1]);
  14.                 if(o == 0)
  15.                 {
  16.                     break;
  17.                 } else {
  18.                     continue;
  19.                 }
  20.             }
  21.             i = Integer.parseInt(str);
  22.             if(i%2 == 0)
  23.             {
  24.                 JOptionPane.showMessageDialog(null, "O número " + i + " é par.", "PAR", JOptionPane.PLAIN_MESSAGE);
  25.             } else
  26.             {
  27.                 JOptionPane.showMessageDialog(null, "O número " + i + " é impar.", "IMPAR", JOptionPane.PLAIN_MESSAGE);
  28.             }
  29.         }
  30.     }
  31.  
  32. }
Submit a correction or amendment below. [ previous version ] | [ difference ] | Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: