Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/morrismagic/algojs


https://github.com/morrismagic/algojs

Last synced: 1 day ago
JSON representation

Awesome Lists containing this project

README

        

//1 Leap Year Checker:
/*
function years(year) {
if ((year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0)) {
return true;
} else {
return false;
}
}
const year = console.log(("Enter a year:"));
if (years(year)) {
console.log(`${year} is a leap year.`);
} else {
console.log(`${year} is not a leap year.`);
}*/

//2 Ticket Pricing

/*
function getTicketPrice(age) {
if (age <= 12) {
return 10;
} else if (age >= 13 && age <= 17) {
return 15;
} else {
return 20;
}
}
const age = parseInt(prompt("Enter your age:"));
const price = getTicketPrice(age);
console.log("The price of Ticket is :"+price+(" $"));*/

//3 Fibonacci Sequence
/*
function fibonacci(n) {
if (n <= 1) {
return n;
} else {
return fibonacci(n - 1) + fibonacci(n - 2);
}
}
console.log(fibonacci(20));*/