Created
November 10, 2014 16:10
-
-
Save samueltcsantos/f47094933f2b0a66c35b to your computer and use it in GitHub Desktop.
Converter metros para centímetros em Java.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
/** | |
* @author Samuel T. C. Santos | |
* @version 09.11.2014 | |
* | |
* Exemplo de execução (Use virgula e não ponto!): | |
* Metros? 2,36 | |
* 236,0 cm | |
* | |
*/ | |
public class Conversor { | |
public static void main(String args[]){ | |
Scanner entrada = new Scanner(System.in); | |
System.out.print("Metros? "); | |
float metros = entrada.nextFloat(); | |
float centimetros = metros * 100; | |
System.out.printf("%.1f cm",centimetros); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment