UNA HERMOSA MOTO

UNA HERMOSA MOTO

miércoles, 22 de abril de 2015

Problema Propuesto 03



03.- DADA UNA CANTIDAD DE MILÍMETROS EXPRESARLO EN METROS, DECÍMETROS Y CENTÍMETROS.



Resultado de imagen para METROS DECIMETROS CENTIMETROS Y MILIMETROS


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package problema13;
import java.io.*;
/**
 *
 * @author abel montalvan
 */
public class Problema13 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
         final int METRO=1000;
         final int DECIMETRO=100;
         final int CENTIMETRO=10;
         
         int mm,m,d,c;
     
BufferedReader in =new BufferedReader(new  InputStreamReader(System.in));
 System.out.println("Cantidad de milímetros: ");
    mm=Integer.parseInt(in.readLine());
        
    m=mm/METRO;
    d=mm/DECIMETRO;
    c=mm/CENTIMETRO;
        
 System.out.println("");
 System.out.println("Metros: "+m);
 System.out.println("Decímetros: "+d);
 System.out.println("Centímetros: "+c); 
 System.out.println("Milímetros: "+mm); 
        // TODO code application logic here
    }
}


No hay comentarios:

Publicar un comentario