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