Created
March 14, 2019 00:47
-
-
Save salgueiroso/97c89a4185d25745e17814c5d3a68a8c 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 3 | |
* Gerar três inteiros randômicos entre 1 e 10 e informar se estes valores podem ser | |
* vértices de um triângulo. Imprimir os valores e se formam ou não um triângulo. | |
* Dica: três lados formam um triângulo quando a soma de quaisquer dois lados for maior | |
* que o terceiro lado. | |
**/ | |
import 'dart:math'; | |
void main(){ | |
var rnd = new Random(); | |
var numeros = new List(3).map((x) => rnd.nextInt(10)+1); | |
print("Números: $numeros"); | |
var mensagem = PodemSerVertices(numeros) ? "Podem ser vertices": "Não podem ser vértices"; | |
print("Situação: $mensagem"); | |
} | |
bool PodemSerVertices(Iterable<int> numeros){ | |
return numeros.every((x)=>x>0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment