Comprobar HMS

This commit is contained in:
PC de clase committed 2026-09-28 10:16:23 +02:00
1 parent d459661d0a
commit 7af7a01592
1 file changed
+4 -1
+4 -1
View File
@@ -11,6 +11,10 @@ void main() {
h = sc.nextInt();
m = sc.nextInt();
s = sc.nextInt();
if (h >= 24 || m >= 60 || s >= 60){
System.out.println("Error: Hora inválida");
return;
}
s++;
// Espagueti máximo xd
if(s > 59){
@@ -20,7 +24,6 @@ void main() {
m = 0;
h++;
if(h > 23){
m = 0;
h = 0;
}
}