Skip to content

Instantly share code, notes, and snippets.

@luisangelorjr
Last active May 25, 2022 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luisangelorjr/d31ed68f221f4b60588a4fe12fb73e1b to your computer and use it in GitHub Desktop.
Save luisangelorjr/d31ed68f221f4b60588a4fe12fb73e1b to your computer and use it in GitHub Desktop.
Um pequeno trecho de código para ajudar o @GabrielRugallim no Twitter
class Main {
public static void main(String[] args) {
int NumInt;
double NumReal, soma;
char Caracter;
String[] entrada = new String[]{"1", "2.5", "L"};
//entrada de dados
NumInt = Integer.parseInt(entrada[0]);
NumReal = Double.parseDouble(entrada[1]);
Caracter = (entrada[2]).charAt(0); // converte o terceiro digito em caracter
soma = (double)NumInt + NumReal;
System.out.println((double)NumInt + " + " + NumReal + " = " + soma + " sinal " + Caracter);
System.exit(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment