You are on page 1of 2

1 Javascript program to find largest of 3 numbers

2 Javascript program to check if the number is positive or negative

3 Write a JavaScript program that prints the numbers from 1 to 100. But for

multiples of three, print Fizz instead of the number, and for the multiples of

five, print Buzz. For numbers that are multiples of both three and five, print

FizzBuzz

 For every number, if it is divisible by both 3 and 5, add FizzBuzz to the result list.
 Else, Check if the number is divisible by 3, add Fizz.
 Else, Check if the number is divisible by 5, add Buzz.
 Else, add the number by converting it to string.

4 Javascript program to find the factorial of a number

5 Javascript program to find the sum on n natural numbers

<!DOCTYPE html>

<html>

<body>

<h1>JavaScript Functions</h1>

<p>Call a function which performs a calculation and returns the result:</p>

<p id="demo"></p>

<script>

function myFunction() {

let sum = 0;

number=5;

// looping from i = 1 to number

// in each iteration, i is increased by 1

for (let i = 1; i <= number; i++) {

sum += i;
}

document.getElementById("demo").innerHTML = sum;

myFunction();

</script>

</body>

</html>

6 Javascript program to find the factors of a number

7 Javascript program to find the factorial of the number

You might also like