Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SumSecond {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int firstCompetitor = Integer.parseInt(scanner.nextLine());
- int secondCompetitor = Integer.parseInt(scanner.nextLine());
- int thirdCompetitor = Integer.parseInt(scanner.nextLine());
- int sumSeconds = firstCompetitor + secondCompetitor + thirdCompetitor;
- int minutes = sumSeconds / 60;
- int seconds = sumSeconds % 60;
- if (sumSeconds >= 0 && sumSeconds <= 59) {
- if (seconds <= 9) {
- System.out.println(minutes + ":" + "0" + seconds);
- } else {
- System.out.println(minutes + ":" + seconds);
- }
- } else if (sumSeconds >= 60 && sumSeconds <= 119) {
- if (seconds <= 9) {
- System.out.println(minutes + ":" + "0" + seconds);
- } else {
- System.out.println(minutes + ":" + seconds);
- }
- } else if (sumSeconds >= 120 && sumSeconds <= 179) {
- if (seconds <= 9) {
- System.out.println(minutes + ":" + "0" + seconds);
- } else {
- System.out.println(minutes + ":" + seconds);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement