[프로그래머스 | 자바스크립트] 세균 증식
프로그래머스(Javascript)/Level 0
2023. 2. 5. 17:22
솔루션 const solution = (n, t) => { const answer = n * 2 ** t; console.log(answer); return answer; }; 솔루션 const solution2 = (n, t) => { console.log(n 0) { n *= 2; } console.log(n); return n; }; 솔루션 const solution4 = (n, t) => { const answer = n * Math.pow(2, t); console.log(answer); return answer; };

리눅스 반복문
Linux
2021. 12. 20. 13:55
Shell Loop Types 이번 시간에서는 Unix Shell에서 사용하는 반복문에 대해서 알아본다. 반복은 일련의 명령을 반복할 수 있도록 하는 프로그래밍 도구로서 아래에서 다양한 반복문 종류를 살펴보도록 한다. 각각의 반복문은 상황에 따라서 적절하게 선택할 수 있어야 한다. The while loop while 반복문은 조건이 발생할 때까지 명령을 지속적으로 실행한다. 문법 while command do Statement(s) to be executed if command is true done Example #!/bin/sh a=0 while [ $a -lt 10 ] do echo $a a=`expr $a + 1` done $ ./while.sh 0 1 2 3 4 5 6 7 8 9 The for..