Skip to content

Instantly share code, notes, and snippets.

@jonathan-irvin
Last active August 29, 2015 14:19
Show Gist options
  • Save jonathan-irvin/0e6c9d238e5ef8ea7544 to your computer and use it in GitHub Desktop.
Save jonathan-irvin/0e6c9d238e5ef8ea7544 to your computer and use it in GitHub Desktop.
Convert minutes to years
import java.util.Scanner;
public class Minutes2Years {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.print("Enter the number of minutes: ");
Scanner input = new Scanner(System.in);
int minutes;
minutes = input.nextInt();
//525949 minutes per year
int years = minutes / 525949;
//1440 minutes per day
int days = (minutes % 525949) / 1440;
System.out.println(minutes + " minutes is "+ years + " years and "+days+" days.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment