"카타 8급 If you can't sleep, just count sheep!!"의 두 판 사이의 차이

23번째 줄: 23번째 줄:
==PHP==
==PHP==
[[분류: PHP]]
[[분류: PHP]]
<source lang='php'>
function countsheep($num){
  $res = '';
  for($i=1; $i<=$num; $i++) $res .= "$i sheep...";
  return $res;
}
</source>
<source lang='php'>
<source lang='php'>
function countsheep($num){
function countsheep($num){

2019년 1월 28일 (월) 16:42 판

1 개요

카타 8급 C
# 🔗 문제 풀이

틀:카타 8급-1

2 JavaScript

var countSheep = function (num){
  let res = "";
  for(let i=1; i<=num; i++) res += `${i} sheep...`;
  return res;
}
var countSheep = function (num){
  var res = "";
  for(i=1; i<=num; i++) res += i+" sheep...";
  return res;
}

3 PHP

function countsheep($num){
  $res = '';
  for($i=1; $i<=$num; $i++) $res .= "$i sheep...";
  return $res;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}