UNA HERMOSA MOTO

UNA HERMOSA MOTO

miércoles, 22 de abril de 2015

Problema Resuelto 17



17.- DADO UN NUMERO DEVOLVER EL DOBLE SI NO ES PAR DE LO CONTRARIO, EL TRIPLE.



Resultado de imagen para DOBLE Y TRIPLEResultado de imagen para DOBLE Y TRIPLE

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

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

No hay comentarios:

Publicar un comentario