Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TimeAdd15Min {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int hours = Integer.parseInt(scanner.nextLine());
- int minutes = Integer.parseInt(scanner.nextLine());
- int timeInMinutes = hours * 60 + minutes;
- int addTime = timeInMinutes + 15;
- int totalTimeHours = addTime / 60;
- int totalTimeMinutes = addTime % 60;
- if(totalTimeHours == 24){
- totalTimeHours =0;
- }
- System.out.printf("%d:%02d", totalTimeHours,totalTimeMinutes);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement