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