Created
March 14, 2019 00:30
-
-
Save salgueiroso/b93dc5afb03f52ba1cc29b3403878a5c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* Questão 2 | |
* Gerar uma nota randômica (com 1 casa decimal) entre 0 e 10 e imprimir a nota e a mensagem correspondente; | |
* i) “Reprovado” – menor que 4; | |
* ii) “Prova Final” – maior ou igual a 4 e menor que 6; | |
* iii) “Aprovado” – maior ou igual a 6. | |
**/ | |
import 'dart:math'; | |
void main() { | |
var nota = new Random().nextInt(101) / 10; | |
var notaFormatada = nota.toStringAsFixed(1); | |
print("Nota: $notaFormatada"); | |
var situacao = nota < 4 | |
? "Reprovado" | |
: nota >= 4 && nota < 6 ? "Prova Final" : "Aprovado"; | |
print("Situação: $situacao"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment