Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class Main {
- public static void main(String[] args) {
- Scanner scanner=new Scanner(System.in);
- int h1=scanner.nextInt();
- int m1=scanner.nextInt();
- int h2=scanner.nextInt();
- int m2=scanner.nextInt();
- int hour=0,min=0;
- if(h2>h1){
- hour=h2-h1;
- }
- else if(h2==h1){
- if(m2>m1){
- hour=0;
- }
- else{
- hour=24;
- }
- }
- else{
- hour=(h2-h1)+24;
- }
- if(m2==m1){
- min=0;
- }
- else if(m2>m1){
- min=m2-m1;
- }
- else{
- min=60-(m1-m2);
- hour=hour-1;
- }
- System.out.println("O JOGO DUROU "+hour+" HORA(S) E "+min+" MINUTO(S)\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement