Topics
Javascript Assignment
By Saket Bhatnagar••Beginner to Intermediate
practice questions
- 1Write a program to find square and cube of a given number.
- 2Write a program to check if a given year is a leap year or not.
- 3Write a program to calculate the sum of the first 100 natural numbers.
- 4Write a program to check if a given number is even or odd.
- 5Write a program to print the sum of all even numbers from 1 to any given number.
- 6Write a program to print the sum of all odd numbers from 1 to any given number.
- 7Write a program to count the number of digits in a given number.
- 8Write a program to calculate the sum of the digits of a given number.
- 9Write a program to print the multiplication table of a given number.
- 10Write a program to reverse a given number. For example, if the input is 12345, the output should be 54321.
- 11Write a program that prints the numbers from 1 to 100. But for multiples of three, print 'Fizz' instead of the number, and for multiples of five, print 'Buzz.' For numbers that are multiples of both three and five, print 'FizzBuzz.'
- 12Write a program to calculate the power of a number without using the Math.pow() function.
- 13Write a program to check if a given number is prime or not.
- 14Write a program to find and print all the prime numbers within 1-100.
- 15Write a program to calculate the factorial of a given number.
- 16Write a program to print the Fibonacci series up to a given number.
- 17Write a program to calculate the sum of the first 20 Fibonacci numbers.
- 18Write a program to check if a given number is a perfect number.
- 19Write a program to check if a given number is an Armstrong number.
- 20Write a program to check if a given number is a strong number.
- 21Write a program to check a number whose last digit is 7.
- 22Print the number which ends with 7 or is divided by 7.
- 23Print numbers up to 500 that are divided by 7 and end with 7.
- 24Write a program to print the factors of a number and also print the number of factors of that number.