Skip to content

Instantly share code, notes, and snippets.

@Jhonnyrbueno
Forked from samueltcsantos/Conversor.java
Created March 5, 2019 22:00
Show Gist options
  • Save Jhonnyrbueno/e92fe6e5a143c48db8af8e0e76573e4e to your computer and use it in GitHub Desktop.
Save Jhonnyrbueno/e92fe6e5a143c48db8af8e0e76573e4e to your computer and use it in GitHub Desktop.
Converter metros para centímetros em Java.
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