[JS] 간단한 문제 풀이(팩토리얼, 거스름돈 구하기, 팰린드롬)
팩토리얼function factorial(n) { let result = 1; if(n !== 0){ // 만약 n이 0이 아니라면 // i는 1부터 n까지 1씩 증가하면서 result와 곱셈 실행(팩토리얼 연산) for(let i = 1; i거스름돈 구하기function calculateChange(payment, cost) { let change = payment - cost; let tTh5 = 0 // 5만원 let tTh1 = 0 // 1만원 let th5 = 0 // 5천원 let th1 = 0; // 1천원 // change가 0이 될 때까지 반복 while(change !== 0){ if(change >= 50000){ /..
JavaScript
2024. 11. 13. 22:51