Advertisement
martinvalchev

Sum Seconds

Oct 23rd, 2017
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SumSeconds {
  4.     public static void  main ( String [] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int a = Integer.parseInt(scanner.nextLine());
  7.         int b = Integer.parseInt(scanner.nextLine());
  8.         int c = Integer.parseInt(scanner.nextLine());
  9.  
  10.         int sum = a + b + c;
  11.         int minute = sum / 60;
  12.         int seconds = sum % 60;
  13.  
  14.         System.out.print(minute + ":");
  15.         if (seconds < 10) {
  16.  
  17.         System.out.println("0" + seconds);
  18.     } else {
  19.             System.out.println(seconds);
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement