Liberar recursos en condicionales
This commit is contained in:
1 parent
2e8c5cae24
commit
42ccb65310
3 files changed
+5
No files matched your search
@@ -14,11 +14,13 @@ void main() {
|
||||
|
||||
if (!(ano >= 1970 && ano < 3000)) {
|
||||
System.out.println("Fecha inválida");
|
||||
sc.close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(mes > 0 && mes <= 12)){
|
||||
System.out.println("Fecha inválida");
|
||||
sc.close();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -41,6 +43,7 @@ void main() {
|
||||
|
||||
if (!(dia > 0 && dia <= diasMaximo)) {
|
||||
System.out.println("Fecha inválida");
|
||||
sc.close();
|
||||
return;
|
||||
}
|
||||
System.out.println("Fecha válida");
|
||||
|
||||
@@ -23,6 +23,7 @@ void main() {
|
||||
case '/':
|
||||
if (n2 == 0){
|
||||
System.out.println("Imposible dividir entre 0");
|
||||
sc.close();
|
||||
return;
|
||||
}
|
||||
result = n1 / n2;
|
||||
|
||||
@@ -13,6 +13,7 @@ void main() {
|
||||
s = sc.nextInt();
|
||||
if (h >= 24 || m >= 60 || s >= 60){
|
||||
System.out.println("Error: Hora inválida");
|
||||
sc.close();
|
||||
return;
|
||||
}
|
||||
s++;
|
||||
|
||||
Reference in new issue
Block a user