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