Advertisement
MladenKarachanov

SumSeconds

Sep 17th, 2023
750
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. package programmingBasics;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class SumSeconds {
  6.     public static void main(String[] args) {
  7.         Scanner scanner= new Scanner(System.in);
  8.         int firstTime=Integer.parseInt(scanner.nextLine());
  9.         int secondTime=Integer.parseInt(scanner.nextLine());
  10.         int treeTime=Integer.parseInt(scanner.nextLine());
  11.         int totaltime=firstTime+secondTime+treeTime;
  12.         int minutes=totaltime/60;
  13.         int second=totaltime % 60;
  14.         if (second<10) {
  15.             System.out.printf("%d:0%d %n", minutes, second);
  16.         }else{
  17.             System.out.printf(" %d:%d",minutes,second);
  18.         }
  19.     }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement