DeveloperBreeze

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);

Continue Reading

Discover more amazing content handpicked just for you

Tutorial
javascript

Non-Primitive Data Types (Objects, Arrays, and Functions)

    console.log(person["age"]); // 25
  • Adding/Updating Properties:

Dec 11, 2024
Read More
Tutorial
javascript

Easy JavaScript Tutorial for Beginners

document.getElementById('myButton').addEventListener('click', function() {
    alert('Hello from external JavaScript!');
});

JavaScript code consists of statements, which are executed one after another. Each statement should end with a semicolon (;), though it is not strictly required.

Sep 18, 2024
Read More
Cheatsheet
solidity

Solidity Cheatsheet

  • Avoid complex computations within loops.

  • Use immutable and constant for variables that do not change.

Aug 22, 2024
Read More
Code
javascript

Prime Number Check and Prime Number Generation in JavaScript

No preview available for this content.

Jan 26, 2024
Read More
Code
php

Recursive Factorial Calculation in PHP

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
javascript

Fibonacci Sequence in JavaScript

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

Swap Two Numbers Without Using a Temporary Variable

No preview available for this content.

Jan 26, 2024
Read More

Discussion 0

Please sign in to join the discussion.

No comments yet. Start the discussion!