Skip to content

Instantly share code, notes, and snippets.

@folivetti
Created February 17, 2017 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save folivetti/f4de1be8cbe153e2fe010886dfbfbb47 to your computer and use it in GitHub Desktop.
Save folivetti/f4de1be8cbe153e2fe010886dfbfbb47 to your computer and use it in GitHub Desktop.
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
int inicio, fim, horas;
Scanner sc = new Scanner(System.in);
inicio = sc.nextInt();
fim = sc.nextInt();
if (inicio == fim) {
horas = 24;
} else if (inicio > fim) {
horas = 24 - inicio + fim;
} else {
horas = fim - inicio;
}
System.out.printf("O JOGO DUROU %d HORA(S)", horas);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment