Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package _02_ConditionalStatements;
- import java.util.Scanner;
- public class SumSeconds {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int firstTime = Integer.parseInt(scanner.nextLine());
- int secondTime = Integer.parseInt(scanner.nextLine());
- int thirdTime = Integer.parseInt(scanner.nextLine());
- int finalTimeInSeconds = firstTime + secondTime + thirdTime;
- int minutes = finalTimeInSeconds / 60;
- int seconds = finalTimeInSeconds % 60;
- if (seconds < 10) {
- System.out.printf("%d:0%d", minutes, seconds);
- } else {
- System.out.printf("%d:%d", minutes, seconds);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement