Está en la página 1de 1

14.

-
import java.util.Scanner;
public class HoraDelSiguienteSegundo {

/**
* h : horas
* m : minutos
* s : segundos
*/
public static void main(String[] args) {
Scanner leer = new Scanner(System.in);
int h, m, s;
System.out.println("Ingese horas: ");
h = leer.nextInt();
System.out.println("Ingese minutos: ");
m = leer.nextInt();
System.out.println("Ingese segundo: ");
s = leer.nextInt();

s = s+1;
if(s == 60)
{
s = 0;
m = m+1;
if(m == 60)
{
m = 0;
h = h+1;
if(h==24)
{
h=0;
}
}
}
System.out.println("Horas correspondiente al siguiente segundo:
"+h+":"+m+":"+s);
}
}

También podría gustarte