Swap Two Numbers

Easy Numbers
Swap the values of two variables.

Sample input

a = 5, b = 10

Sample output

10 5

Solution

a, b = 5, 10
a, b = b, a
print(a, b)
let a = 5, b = 10;
[a, b] = [b, a];
console.log(a, b);
public class Main {
    public static void main(String[] args) {
        int a = 5, b = 10;
        int temp = a;
        a = b;
        b = temp;
        System.out.println(a + " " + b);
    }
}
fun main() {
    var a = 5
    var b = 10
    a = b.also { b = a }
    println("$a $b")
}
var a = 5, b = 10
(a, b) = (b, a)
print("\(a) \(b)")
void main() {
  int a = 5, b = 10;
  int temp = a;
  a = b;
  b = temp;
  print('$a $b');
}
#include <iostream>
#include <utility>
using namespace std;

int main() {
    int a = 5, b = 10;
    swap(a, b);
    cout << a << " " << b << endl;
    return 0;
}
#include <stdio.h>

int main() {
    int a = 5, b = 10;
    int temp = a;
    a = b;
    b = temp;
    printf("%d %d\n", a, b);
    return 0;
}