UNA HERMOSA MOTO

UNA HERMOSA MOTO

miércoles, 22 de abril de 2015

Problema Resuelto 12



12.- DETERMINAR SI UN NÚMERO ES POSITIVO, NEGATIVO O NEUTRO

Resultado de imagen para POSITIVO NEGATIVO Y NEUTRO

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package problema012;
import java.io.*;
/**

 *
 * @author abel montalvan
 */
public class Problema012 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException{
     int n;
     String r = "";
 BufferedReader in=new BufferedReader(new  InputStreamReader(System.in));
 System.out.println("Número: ");
 n=(int)Integer.parseInt(in.readLine());
 if (n>0)
 {
  r="POSITIVO";
 }
 if (n<0)
 {
  r="NEGATIVO";
 }
 if(n==0)
 {
  r="NEUTRO";
 }
  System.out.println("");
 System.out.println("Resultado: "+r);

       
    }
}
      

No hay comentarios:

Publicar un comentario