Guest User

if/else

a guest
Feb 23rd, 2010
723
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. package tuto1;
  2. /*author belial9826
  3.  aplicacion para juangonza.wordpress.com*/
  4.  
  5. public class tuto1{
  6.  
  7.     public static void main(String[] args) {
  8.  
  9.         float n1, n2, d;
  10.  
  11.         System.out.print("Ingrese el primer numero: ");
  12.         n1 = Leer.datoInt();
  13.         System.out.print("Ingrese el segundo numero: ");
  14.         n2 = Leer.datoInt();
  15.         if (n2 == 0){
  16.             System.out.println("\nNo se puede realizar la operacion");
  17.         }
  18.         else{
  19.             d = n1/n2;
  20.             System.out.println("El resultado es: "+d);
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment