Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Minutes {
- public static void main(String[] args){
- Scanner scanner = new Scanner(System.in);
- int firstCompetition = scanner.nextInt();
- int secondCompetition = scanner.nextInt();
- int thirdCompetition = scanner.nextInt();
- int secondInputs = firstCompetition + secondCompetition + thirdCompetition;
- double minutes = Math.round((secondInputs / 60d) * 100d) / 100d;
- double decimals = Math.round((minutes - Math.floor(minutes)) * 100d) / 100d ;
- int seconds = (int)Math.round(decimals * 60);
- if (seconds < 10) {
- System.out.println((int) minutes + ":0" + seconds);
- } else if (seconds == 0){
- System.out.println((int) minutes + ":00");
- }
- if (seconds == 10 & seconds == 20 & seconds == 30 & seconds == 40 & seconds == 50) {
- System.out.println((int) minutes + ":" + seconds + "0");
- } else {
- System.out.println((int) minutes + ":" + seconds);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement