KeepCoding

SumSeconds02

Oct 24th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.time.LocalDate;
  4. import java.time.format.DateTimeFormatter;
  5. import java.util.Scanner;
  6.  
  7. public class SummingSeconds {
  8. public static void main(String[] args) {
  9. Scanner scanner = new Scanner(System.in);
  10. int p1 = Integer.parseInt(scanner.nextLine());
  11. int p2 = Integer.parseInt(scanner.nextLine());
  12. int p3 = Integer.parseInt(scanner.nextLine());
  13. int result = p1 + p2 + p3;
  14. if (result <60) {
  15. if (result<10) {
  16. System.out.println("0:0" + result);
  17. } else {
  18. System.out.println("0:" + result);
  19. }
  20. } else if (result >=60 && result<120) {
  21. if (result-60<10) {
  22. System.out.println("1:0" + (result-60));
  23. } else {
  24. System.out.println("1:" + (result - 60));
  25. }
  26. } else if (result>=120 && result < 180) {
  27. if (result-120<10) {
  28. System.out.println("2:0" + (result-120));
  29. } else {
  30. System.out.println("2:" + (result - 120));
  31. }
  32. }
  33. //code ends here
  34. }
  35. }
Add Comment
Please, Sign In to add comment