The time military
The time military is very easy to do as it consists of making three equal tucked into each other is the first time, must be less than 24 to stop when you reach 24; inside is going to be one that is minute and has to less than 60 because when you reach 60 advanced one hour; finally be the third while inside while the other two and is the second must also be like less than 60 minutes to get to this number when advance one minute within this has to be a System.out.println where this variable hour, minute and second in the code as shown below is displayed 00:00:00 to 23:59:59.
public static
void main(String[] args) {
int hora =
0;
int
minuto = 0;
int
segundo = 0;
while
(hora < 24) {
while (minuto < 60) {
while
(segundo < 60) {
System.out.println(hora
+ ":" + minuto + ":" + segundo);
segundo
= segundo + 1;
}
minuto
= minuto + 1;
segundo
= 0;
}
hora
= hora + 1;
minuto
= 0;
}
Comentarios
Publicar un comentario