Advertisement
KeepCoding

SumSeconds

Oct 23rd, 2017
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 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.  
  7.  
  8.         int sec1 = Integer.parseInt(scanner.nextLine());
  9.         int sec2 = Integer.parseInt(scanner.nextLine());
  10.         int sec3 = Integer.parseInt(scanner.nextLine());
  11.         int sumseconds = sec1 + sec2 + sec3;
  12.         int minutes = sumseconds / 60;
  13.         int seconds = sumseconds % 60;
  14.         System.out.printf("%d:%02d", minutes, seconds);
  15.         //code ends here
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement