Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

mathematical operation with js #9

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// addition of two numbers
function addition(a, b) {
return a + b;
}

// subtraction of two numbers
function subtraction(a, b) {
return a - b;
}

// multiplication of two numbers
function multiplication(a, b) {
return a * b;
}

// division of two numbers
function division(a, b) {
return a / b;
}

// determine if it's a prime number
function isPrime(num) {
for (var i = 2; i < num; i++) {
if (num % i === 0) {
return false;
}
}
return num > 1;
}