Advertisement
KeepCoding

SumSeconds03

Oct 24th, 2017
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Marketing {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. Scanner console = new Scanner(System.in);
  7. Integer seconds1 = Integer.parseInt(console.nextLine());
  8. Integer seconds2 = Integer.parseInt(console.nextLine());
  9. Integer seconds3 = Integer.parseInt(console.nextLine());
  10. Integer seconds = seconds1 + seconds2 + seconds3;
  11. Integer minutes = 0;
  12.  
  13. if (seconds>119) {
  14. minutes+=2;
  15. seconds = seconds - 120;
  16. }else if (seconds>59){
  17. minutes++;
  18. seconds = seconds-60;
  19.  
  20. }if (seconds<10){
  21. System.out.println(minutes + ":" + "0" + seconds);
  22. } else {
  23. System.out.println(minutes + ":" + seconds);
  24. }
  25. //code ends here
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement