Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. //package despertador;
  2. import java.util.Scanner;
  3.  
  4. class Despertador {
  5.  
  6. public static void main(String[] args) {
  7. Scanner leia = new Scanner(System.in);// Faz leitura das informações
  8.  
  9. int H1 = leia.nextInt();
  10. int M1 = leia.nextInt();
  11. int H2 = leia.nextInt();
  12. int M2 = leia.nextInt();
  13.  
  14. if (H1==0 & H2==0 & M1==0 & M2==0); // Cria uma condição
  15.  
  16. int T1 = (H1 * 60) + M1; // Operação Matemática
  17. int T2 = (H2 * 60) + M2;
  18.  
  19. if (T1 < T2){ // Outra Condição
  20. System.out.println(T2 - T1);
  21. }
  22. else{ //Caso contrário
  23. System.out.println(1440+(T2-T1));
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement