Last active
May 25, 2022 01:08
-
-
Save luisangelorjr/d31ed68f221f4b60588a4fe12fb73e1b to your computer and use it in GitHub Desktop.
Um pequeno trecho de código para ajudar o @GabrielRugallim no Twitter
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
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