Q) 평균적으로 어떤 사람이 유능한 자바 프로그래머로서 인정을 받으려면 대략 4,350,000초의 연구 경험이 필요하다고 한다. 유능한 자바 프로그래머가 되기 위해 필요한 일, 시간, 분, 초를 계산하고 출력하는 프로그램을 작성하시오.

Ex2_3.txt


public class Ex2_3 {

	public static void main(String[] args) {

		int totalSec = 4350000;

		int day = totalSec / (60 * 60 * 24);
		int hour = (totalSec - day * 60 * 60 * 24) / (60 * 60); 
		int minute = (totalSec - day * 60 * 60 * 24 - hour * 3600) / 60; 
		int second = totalSec % 60;

		System.out.println(day + "일 " + hour + "시간 " + minute + "분 " + second
				+ "초");

	}
}




posted by 쪼재