Advertisement
Spocoman

01. Sum Seconds

Aug 24th, 2024 (edited)
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 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.         int firstTime = Integer.parseInt(scanner.nextLine());
  7.         int secondTime = Integer.parseInt(scanner.nextLine());
  8.         int thirdTime = Integer.parseInt(scanner.nextLine());
  9.  
  10.         int total = firstTime + secondTime + thirdTime;
  11.         int minutes = total / 60;
  12.         int seconds = total % 60;
  13.  
  14.         System.out.printf("%d:%02d", minutes, seconds);
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement