---
# System prepended metadata

title: C

---

# C
```
int sum(int num1, int num2){
    return num1 + num2;
}
```
# C++
```
class Solution {
public:
    int sum(int num1, int num2) {
        return num1 + num2;
    }
};
```
# C#
```
public class Solution {
    public int Sum(int num1, int num2) {
        return num1 + num2;
    }
}
```
# Python
```
class Solution(object):
    def sum(self, num1, num2):
        return num1 + num2
```

# Python3
```
class Solution:
    def sum(self, num1: int, num2: int) -> int:
        return num1 + num2
```
# Java
```
class Solution {
    public int sum(int num1, int num2) {
        return num1 + num2;
    }
}
```
# Javascript
```
/**
 * @param {number} num1
 * @param {number} num2
 * @return {number}
 */
var sum = function(num1, num2) {
    return num1 + num2;
};
```
# Ruby
```
# @param {Integer} num1
# @param {Integer} num2
# @return {Integer}
def sum(num1, num2)
    return num1 + num2
end
```
# swift
```
class Solution {
    func sum(_ num1: Int, _ num2: Int) -> Int {
        return num1 + num2;
    }
}
```
# golang
```
func sum(num1 int, num2 int) int {
    return num1 + num2;
}
```
# scala
```
object Solution {
    def sum(num1: Int, num2: Int): Int = {
        return num1 + num2;
    }
}
```
# kotlin
```
class Solution {
    fun sum(num1: Int, num2: Int): Int {
        return num1 + num2;
    }
}
```
# rust
```
impl Solution {
    pub fn sum(num1: i32, num2: i32) -> i32 {
        return num1 + num2;
    }
}
```
# php
```
class Solution {

    /**
     * @param Integer $num1
     * @param Integer $num2
     * @return Integer
     */
    function sum($num1, $num2) {
        return $num1 + $num2;
    }
}
```
# typescript
```
function sum(num1: number, num2: number): number {
    return num1 + num2;
};
```
# racket
```
(define/contract (sum num1 num2)
  (-> exact-integer? exact-integer? exact-integer?)
    (+ num1 num2)
  )
```
# erlang
```
-spec sum(Num1 :: integer(), Num2 :: integer()) -> integer().
sum(Num1, Num2) -> Num1 + Num2
  .
```
# elixir
```
defmodule Solution do
  @spec sum(num1 :: integer, num2 :: integer) :: integer
  def sum(num1, num2) do
    num1 + num2
  end
end
```
# dart
```
class Solution {
  int sum(int num1, int num2) {
    return num1 + num2;
  }
}
```