Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class fifteenMinutes {
- 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 sumH = (hours * 60 + minutes + 15) / 60;
- int sumM = (hours * 60 + minutes + 15) % 60;
- if(hours == 23)
- {
- if (minutes >= 45)
- {
- if (sumM < 10) {
- System.out.printf("0:0%d", sumM);
- } else {
- System.out.printf("0:%d", sumM);
- }
- }
- else
- {
- if (sumM < 10) {
- System.out.printf("%d:0%d", sumH, sumM);
- } else {
- System.out.printf("%d:%d", sumH, sumM);
- }
- }
- }
- else
- {
- if (sumM < 10) {
- System.out.printf("%d:0%d", sumH, sumM);
- } else {
- System.out.printf("%d:%d", sumH, sumM);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement