0% found this document useful (0 votes)
3 views

JavaScript Examples Basic, If, Loop

The document provides a comprehensive list of JavaScript programming exercises categorized into three sections: basic programming exercises, if...else programming exercises, and loop programming exercises. Each section contains multiple tasks aimed at enhancing JavaScript skills, such as performing arithmetic operations, checking conditions, and utilizing loops. Additionally, it includes contact information and a web address for further inquiries.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

JavaScript Examples Basic, If, Loop

The document provides a comprehensive list of JavaScript programming exercises categorized into three sections: basic programming exercises, if...else programming exercises, and loop programming exercises. Each section contains multiple tasks aimed at enhancing JavaScript skills, such as performing arithmetic operations, checking conditions, and utilizing loops. Additionally, it includes contact information and a web address for further inquiries.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

List of basic JavaScript programing exercises

1. Write a JavaScript program to perform input/output of all basic data types.


2. Write a JavaScript program to enter two numbers and find their sum.
3. Write a JavaScript program to enter two numbers and perform all arithmetic operations.
4. Write a JavaScript program to enter length and breadth of a rectangle and find its perimeter.
5. Write a JavaScript program to enter length and breadth of a rectangle and find its area.
6. Write a JavaScript program to enter radius of a circle and find its diameter, circumference and area.
7. Write a JavaScript program to enter length in centimeter and convert it into meter and kilometer.
8. Write a JavaScript program to enter temperature in Celsius and convert it into Fahrenheit.
9. Write a JavaScript program to enter temperature in Fahrenheit and convert to Celsius
10. Write a JavaScript program to convert days into years, weeks and days.
11. Write a JavaScript program to find power of any number x ^ y.
12. Write a JavaScript program to enter any number and calculate its square root.
13. Write a JavaScript program to enter two angles of a triangle and find the third angle.
14. Write a JavaScript program to enter base and height of a triangle and find its area.
15. Write a JavaScript program to calculate area of an equilateral triangle.
16. Write a JavaScript program to enter marks of five subjects and calculate total, average and percentage.
17. Write a JavaScript program to enter P, T, R and calculate Simple Interest.
18. Write a JavaScript program to enter P, T, R and calculate Compound Interest.

Mob No- 9595775123 Add - Opp VP Collage, Beside Bank Of Maharashtra MIDC , Baramati, Dist.Pune. Web -iStepUp.in
2. List of if...else programming exercises

1. Write a JavaScript to find maximum between two numbers.

2. Write a JavaScript to find maximum between three numbers.

3. Write a JavaScript to check whether a number is negative, positive or zero.

4. Write a JavaScript to check whether a number is divisible by 5 and 11 or not.

5. Write a JavaScript to check whether a number is even or odd.

6. Write a JavaScript to check whether a year is leap year or not.

7. Write a JavaScript to check whether a character is alphabet or not.

8. Write a JavaScript to input any alphabet and check whether it is vowel or consonant.

9. Write a JavaScript to input any character and check whether it is alphabet, digit or special character.

10. Write a JavaScript to check whether a character is uppercase or lowercase alphabet.

11. Write a JavaScript to input week number and print week day.

12. Write a JavaScript to input month number and print number of days in that month.

13. Write a JavaScript to count total number of notes in given amount.

14. Write a JavaScript to input angles of a triangle and check whether triangle is valid or not.

15. Write a JavaScript to input all sides of a triangle and check whether triangle is valid or not.

16. Write a JavaScript to check whether the triangle is equilateral, isosceles or scalene triangle.

17. Write a JavaScript to find all roots of a quadratic equation.

18. Write a JavaScript to calculate profit or loss.

19. Write a JavaScript to input marks of five subjects Physics, Chemistry, Biology, Mathematics and Computer.
Calculate percentage and grade according to following:

Percentage >= 90% : Grade A


Percentage >= 80% : Grade B
Percentage >= 70% : Grade C
Percentage >= 60% : Grade D
Percentage >= 40% : Grade E
Percentage < 40% : Grade F
20. Write a JavaScript to input basic salary of an employee and calculate its Gross salary according to following:

Basic Salary <= 10000 : HRA = 20%, DA = 80%


Basic Salary <= 20000 : HRA = 25%, DA = 90%
Basic Salary > 20000 : HRA = 30%, DA = 95%

Mob No- 9595775123 Add - Opp VP Collage, Beside Bank Of Maharashtra MIDC , Baramati, Dist.Pune. Web -iStepUp.in
3. List of loop programming exercises

1. Write a JavaScript to print all natural numbers from 1 to n. - using while loop
2. Write a JavaScript to print all natural numbers in reverse (from n to 1). - using while loop
3. Write a JavaScript to print all alphabets from a to z. - using while loop
4. Write a JavaScript to print all even numbers between 1 to 100. - using while loop
5. Write a JavaScript to print all odd number between 1 to 100.
6. Write a JavaScript to find sum of all natural numbers between 1 to n.
7. Write a JavaScript to find sum of all even numbers between 1 to n.
8. Write a JavaScript to find sum of all odd numbers between 1 to n.
9. Write a JavaScript to print multiplication table of any number.
10. Write a JavaScript to count number of digits in a number.
11. Write a JavaScript to find first and last digit of a number.
12. Write a JavaScript to find sum of first and last digit of a number.
13. Write a JavaScript to swap first and last digits of a number.
14. Write a JavaScript to calculate sum of digits of a number.
15. Write a JavaScript to calculate product of digits of a number.
16. Write a JavaScript to enter a number and print its reverse.
17. Write a JavaScript to check whether a number is palindrome or not.
18. Write a JavaScript to find frequency of each digit in a given integer.
19. Write a JavaScript to enter a number and print it in words.
20. Write a JavaScript to calculate factorial of a number.
21. Write a JavaScript to find HCF (GCD) of two numbers.
22. Write a JavaScript to find LCM of two numbers.
23. Write a JavaScript to check whether a number is Prime number or not.
24. Write a JavaScript to print all Prime numbers between 1 to n.
25. Write a JavaScript to find sum of all prime numbers between 1 to n.
26. Write a JavaScript to find all prime factors of a number.
27. Write a JavaScript to check whether a number is Armstrong number or not.
28. Write a JavaScript to print all Armstrong numbers between 1 to n.
29. Write a JavaScript to print Fibonacci series up to n terms.
30. Program to print square star pattern

*****
*****
*****
*****
*****

Mob No- 9595775123 Add - Opp VP Collage, Beside Bank Of Maharashtra MIDC , Baramati, Dist.Pune. Web -iStepUp.in

You might also like