sexta-feira, dezembro 02, 2011


Crescente ou decrescente em Java

public static void main(String[] args) {
     
         float x,c,bu;
     
         x =Float.parseFloat(JOptionPane.showInputDialog(null,"Digite um numero"));
         c =Float.parseFloat(JOptionPane.showInputDialog(null,"Digite um numero"));
       
         if(x<c){
                      DecimalFormat dec=new DecimalFormat("0.0");
                      JOptionPane.showMessageDialog(null,"O menor valor é : "+x);
                      JOptionPane.showMessageDialog(null,"O maior valor é : "+c);
         }
         if(x>c){
                     DecimalFormat dec=new DecimalFormat("0.0");
                     JOptionPane.showMessageDialog(null,"O maior valor é  : "+c);
                    JOptionPane.showMessageDialog(null,"O menor valor é : "+x);
         }
         
    }
0

0 comentários:

Postar um comentário