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