deyanivanov966

CONDITIONAL STATEMENTS - EXERCISE 01. Sum Seconds

Aug 23rd, 2020 (edited)
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SumSeconds {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int A = Integer.parseInt(scanner.nextLine());
  8.         int B = Integer.parseInt(scanner.nextLine());
  9.         int C = Integer.parseInt(scanner.nextLine());
  10.  
  11.         int AA = A+B+C;
  12.  
  13.         int min = AA/60;
  14.         int sec = AA % 60;
  15.  
  16.         if (sec<10){
  17.             System.out.printf("%d:0%d", min,sec);
  18.         }else{
  19.             System.out.printf("%d:%d", min,sec);
  20.         }
  21.     }
  22. }
  23.  
Add Comment
Please, Sign In to add comment