DeveloperBreeze

Swap Two Numbers Without Using a Temporary Variable

int a = 5, b = 10;

a = a + b;
b = a - b;
a = a - b;

System.out.println("a = " + a + ", b = " + b);

Continue Reading

Discover more amazing content handpicked just for you

Code
javascript

Prime Number Check and Prime Number Generation in JavaScript

No preview available for this content.

Jan 26, 2024
Read More
Code
python

Binary Search in Python

No preview available for this content.

Jan 26, 2024
Read More
Code
python

Generate Fibonacci Sequence

No preview available for this content.

Jan 26, 2024
Read More
Code
java

Calculate Factorial

public static long factorial(int n) {
    if (n == 0 || n == 1) {
        return 1;
    }
    return n * factorial(n - 1);
}

int number = 5;
long result = factorial(number);
System.out.println("Factorial of " + number + " is " + result);

Jan 26, 2024
Read More

Discussion 0

Please sign in to join the discussion.

No comments yet. Start the discussion!