BubaLazi

p07_SecondsSum

Mar 12th, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.lang.String;
  3.  
  4. public class SecondsSum{
  5.     public static void main(String[] args) {
  6.         Scanner console = new Scanner(System.in);
  7.  
  8.         int a = Integer.parseInt(console.nextLine());
  9.         int b = Integer.parseInt(console.nextLine());
  10.         int c = Integer.parseInt(console.nextLine());
  11.  
  12.         int timeSum = a + b + c;
  13.  
  14.         if(timeSum <10){
  15.             System.out.println("0:0" + timeSum);
  16.         }else if(timeSum >= 10 && timeSum <= 59){
  17.             System.out.println("0:" + timeSum);
  18.         }else if(timeSum >= 60 && timeSum <= 119){
  19.             System.out.println("1:0"+ (timeSum - 60));
  20.         }else if(timeSum >= 120 && timeSum <= 179){
  21.             System.out.println("2:0" + (timeSum - 120));
  22.         }
  23.  
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment