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