Created with <3 with dartpad.dev.
Created
January 13, 2023 20:44
-
-
Save Wils0nDev/f17ab63d03906e118590e65c9e549c41 to your computer and use it in GitHub Desktop.
Dart-SystemInformationTren
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
void main() { | |
double valor1 = 2; | |
double valor2 = 5; | |
List<double> valores = [valor1, valor2]; | |
double resultado = 0; | |
TypeOperation operacion = TypeOperation.SUMATORIA; | |
switch(operacion){ | |
case TypeOperation.SUMA: | |
resultado = valor1 + valor2; | |
break; | |
case TypeOperation.RESTA: | |
resultado=valor1-valor2; | |
if(resultado < 0){ | |
resultado = 0; | |
} | |
break; | |
case TypeOperation.MULTIPLICACION: | |
resultado = valor1 * valor2; | |
break; | |
case TypeOperation.FACTORIAL: | |
resultado = valor1; | |
break; | |
case TypeOperation.SUMATORIA: | |
for(int i=0;i<valores.length; i++){ | |
resultado = resultado + valores[i]; | |
} | |
break; | |
case TypeOperation.PRODUCTO: | |
for(int i=0;i<valores.length; i++){ | |
resultado = resultado + valores[i]; | |
} | |
break; | |
default: resultado; | |
} | |
print(resultado); | |
} | |
enum TypeOperation { SUMA, RESTA,DIVICION,MULTIPLICACION,FACTORIAL,SUMATORIA,PRODUCTO} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment