inblog logo
|
An's Blog
    JAVA

    [JAVA] 8. 나머지

    윤설안's avatar
    윤설안
    Feb 04, 2025
    [JAVA] 8. 나머지
    Contents
    결과
    💡
    / 는 나눈 뒤 몫 값을 출력, %는 나눈 뒤 나머지 값을 출력
    import java.util.Scanner; public class CalTime { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int time; int sec; int min; System.out.println("초를 입력하시오 : "); time = sc.nextInt(); min = time / 60; sec = time % 60; System.out.println(time + "초는 " + min + "분" + sec + "초입니다."); } }

    결과

    notion image
    Share article
    Contents
    결과

    An's Blog

    RSS·Powered by Inblog