0% found this document useful (0 votes)
3 views4 pages

100 JS Loop Questions

Uploaded by

itzadi980
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

100 JS Loop Questions

Uploaded by

itzadi980
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

100 JavaScript Loop Questions (Basic to

Advanced)

Level 1 — Basic Loops (1–25)

1. Print numbers from 1 to 10.

2. Print numbers from 10 to 1.

3. Print all even numbers from 1 to 100.

4. Print all odd numbers from 1 to 100.

5. Print multiplication table of 5.

6. Print multiplication table of any number.

7. Find sum of first 10 natural numbers.

8. Find sum of numbers from 1 to N.

9. Find factorial of a number.

10. Count digits in a number.

11. Reverse a number.

12. Check if a number is palindrome.

13. Print square of numbers from 1 to 20.

14. Print cube of numbers from 1 to 10.

15. Print ASCII values of alphabets.

16. Print alphabets A to Z.

17. Print lowercase alphabets a to z.

18. Find product of digits of a number.

19. Find sum of digits of a number.

20. Swap two numbers using third variable.

21. Swap two numbers without third variable.

22. Check whether number is positive, negative, or zero.

23. Find largest of two numbers.

24. Find largest of three numbers.

25. Print first N natural numbers.


Level 2 — Intermediate Logic (26–50)

26. Check whether a number is prime.

27. Print prime numbers between 1 to 100.

28. Print Fibonacci series.

29. Find LCM of two numbers.

30. Find HCF/GCD of two numbers.

31. Check Armstrong number.

32. Check perfect number.

33. Check strong number.

34. Find power of a number.

35. Print factors of a number.

36. Count total factors of a number.

37. Find sum of all even numbers between 1 to N.

38. Find sum of all odd numbers between 1 to N.

39. Print reverse Fibonacci series.

40. Convert decimal to binary.

41. Convert binary to decimal.

42. Check leap year.

43. Print numbers divisible by 3 and 5.

44. Print all vowels from a string.

45. Count vowels and consonants in a string.

46. Reverse a string using loop.

47. Check palindrome string.

48. Count frequency of a character in string.

49. Find duplicate characters in string.

50. Remove spaces from a string.

Level 3 — Arrays + Loops (51–75)

51. Print all elements of an array.

52. Find sum of array elements.

53. Find average of array elements.


54. Find largest element in array.

55. Find smallest element in array.

56. Reverse an array.

57. Sort array in ascending order.

58. Sort array in descending order.

59. Count even and odd elements in array.

60. Find second largest number in array.

61. Find duplicate elements in array.

62. Remove duplicate elements from array.

63. Merge two arrays.

64. Copy one array into another.

65. Find frequency of elements in array.

66. Rotate array left by one position.

67. Rotate array right by one position.

68. Find missing number in array.

69. Find common elements between two arrays.

70. Print unique elements of array.

71. Search an element in array.

72. Insert element at specific position.

73. Delete element from specific position.

74. Find maximum difference in array.

75. Find pair whose sum equals target.

Level 4 — Pattern Printing + Advanced (76–100)

76. Print right triangle star pattern.

77. Print inverted triangle star pattern.

78. Print pyramid star pattern.

79. Print diamond star pattern.

80. Print Floyd’s triangle.

81. Print Pascal triangle.

82. Print hollow square pattern.

83. Print hollow pyramid pattern.


84. Print number triangle pattern.

85. Print alphabet triangle pattern.

86. Print butterfly pattern.

87. Print hourglass pattern.

88. Print X pattern using stars.

89. Print checkerboard pattern.

90. Print spiral matrix.

91. Create multiplication matrix using nested loops.

92. Print transpose of matrix.

93. Add two matrices.

94. Subtract two matrices.

95. Multiply two matrices.

96. Find diagonal sum of matrix.

97. Find row-wise sum of matrix.

98. Find column-wise sum of matrix.

99. Create mini ATM menu using loops.

100. Create number guessing game using loops.

You might also like