konversi waktu dari menit ke tahun

Selamat pagi, kali ini saya akan membagikan cara konversi waktu dari menit ke tahun  pada pemrograman java.

import java.util.Scanner;

public class MinutesToYears {

public static void main(String[] iriahus) {
final int MIN_YEAR = 365 * 24 * 60;
final int MIN_MONTH = 30 * 24 * 60;
final int MIN_DAY = 24 * 60;

@SuppressWarnings("resource")
Scanner s = new Scanner(System.in);

System.out.print("Enter the number of minutes: ");
int minutes = s.nextInt();

int years = minutes / MIN_YEAR;
int months = minutes % MIN_YEAR / MIN_MONTH;
int days = minutes % MIN_YEAR % MIN_MONTH / MIN_DAY;
int hours = minutes % MIN_YEAR % MIN_MONTH % MIN_DAY / 60;
int min = minutes % 60;

System.out.println(minutes + " minutes is " + years + " years " + months +
" months " + days + " days " + hours + " hours " + min +
" minutes");
}

}


Thank for visiting. Semoga bermanfaat . . .

Subscribe to receive free email updates:

0 Response to "konversi waktu dari menit ke tahun"

Post a Comment