Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class sustezatel {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- System.out.print("Vreme na igrach 1: ");
- int sustezatel1 = Integer.parseInt(scanner.nextLine());
- if (!(sustezatel1 > 0 && sustezatel1 <= 50)) {
- System.out.println();
- System.out.print("Invalid time");
- return;
- }
- System.out.print("Vreme na igrach 2: ");
- int sustezatel2 = Integer.parseInt(scanner.nextLine());
- if (!(sustezatel2 > 0 && sustezatel2 <= 50)) {
- System.out.println();
- System.out.print("Invalid time");
- return;
- }
- System.out.print("Vreme na igrach 3: ");
- int sustezatel3 = Integer.parseInt(scanner.nextLine());
- if (!(sustezatel3 > 0 && sustezatel3 <= 50)) {
- System.out.println();
- System.out.print("Invalid time");
- return;
- }
- System.out.println();
- int sum = sustezatel1 + sustezatel2+ sustezatel3;
- int minutes = Math.abs(sum / 60);
- int seconds = Math.abs(sum % 60);
- System.out.printf("Total time: %d:%02d", minutes, seconds);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement