Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TimePlus15Minutes {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int hours = Integer.parseInt(scan.nextLine());
- int minutes = Integer.parseInt(scan.nextLine());
- if(minutes >= 45){
- minutes += 15 - 60;
- if (hours == 23){
- hours = 0;
- }
- else{
- hours++;
- }
- }
- else{
- minutes += 15;
- }
- System.out.printf("%-15d:%15d", hours, minutes);
- }
- }
Add Comment
Please, Sign In to add comment