"카타 8급 Multiply"의 두 판 사이의 차이

(같은 사용자의 중간 판 2개는 보이지 않습니다)
37번째 줄: 37번째 줄:
func Multiply(a, b int) int {
func Multiply(a, b int) int {
   return a * b
   return a * b
}
</source>
==JavaScript==
{{카타|8급|JavaScript|1}}
<source lang='JavaScript'>
</source>
<source lang='JavaScript'>
</source>
<source lang='JavaScript'>
</source>
==Kotlin==
{{카타|8급|Kotlin|1}}
<source lang='kotlin'>
fun multiply(x: Double, y: Double) = x * y
</source>
<source lang='kotlin'>
fun multiply(x: Double, y: Double): Double = x * y
</source>
<source lang='kotlin'>
fun multiply(x: Double, y: Double): Double {
    return x * y
}
}
</source>
</source>

2019년 4월 21일 (일) 18:04 판

1 Bash

#!/bin/bash -e
a=$1
b=$2
expr $a \* $b
#!/bin/bash -e
a=$1
b=$2
echo $((a*b))

2 C

int multiply(int a, int b) {
  return a * b;
}

3 C++

int multiply(int a, int b)
{
    return a * b;
}

4 Go

package multiply

func Multiply(a, b int) int {
  return a * b
}

5 JavaScript

6 Kotlin

fun multiply(x: Double, y: Double) = x * y
fun multiply(x: Double, y: Double): Double = x * y
fun multiply(x: Double, y: Double): Double {
    return x * y
}

7 PHP

function multiply($a, $b) {
  return $a * $b;
}

8 R

mul <- function(a, b) {
  a * b
}
mul <- function(a, b) {
  return(a * b);
}
mul <- `*`
mul = `*`