본문 바로가기
알고리즘/기초

연필갯수

by 달보드레. 2021. 9. 28.

연필 1다스는 12자루 입니다.

학생 1인당 연필을 1자루씩 나누어 준다고 할 때 N명의 학생수를 입력하면

필요한 연필 다스 수를 계산하는 프로그램을 작성하세요.

<!DOCTYPE html>
<head>
</head>
<body>
    <script>
         var input = prompt('1000이하의 자연수 A를 입력해주세요.');
        
         function pencil(input)
         {
            pecilDas = input / 12;
            alert(Math.ceil(pecilDas));
         }
        
         pencil(input);
    </script>
</body>
</html>

https://github.com/LeeDH-git/algorithm-JS/blob/main/%EC%97%B0%ED%95%84%EA%B0%AF%EC%88%98.html

'알고리즘 > 기초' 카테고리의 다른 글

홀수  (0) 2021.09.30
최솟값 구하기  (0) 2021.09.29
1부터 N까지의 합  (0) 2021.09.28
삼각형 판별하기  (0) 2021.09.28
세 수 중 최솟값 구하기  (0) 2021.09.28