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