Liberar recursos en condicionales

This commit is contained in:
T-Royale committed 2026-10-02 14:13:45 +02:00
1 parent 2e8c5cae24
commit 42ccb65310
3 files changed
+7 -2

No files matched your search

+4 -1
View File
@@ -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,8 +43,9 @@ void main() {
if (!(dia > 0 && dia <= diasMaximo)) {
System.out.println("Fecha inválida");
sc.close();
return;
}
System.out.println("Fecha válida");
sc.close();
}
}
+1
View File
@@ -23,6 +23,7 @@ void main() {
case '/':
if (n2 == 0){
System.out.println("Imposible dividir entre 0");
sc.close();
return;
}
result = n1 / n2;
+2 -1
View File
@@ -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++;
@@ -30,4 +31,4 @@ void main() {
}
System.out.printf("En una hora serán las %02d:%02d:%02d\n", h, m, s);
sc.close();
}
}