1–28
1–28. Number & Basic Math
- 1. WAP for area of Triangle (1/2 × a × b).
- 2. WAP for area of Rectangle.
- 3. WAP for area of Circle.
- 4. WAP for area of Square.
- 5. WAP for area of Rhombus.
- 6. WAP for area of Polygon.
- 7. WAP for Factorial of a given number.
- 8. WAP for first 20 factorial numbers (0 to 20).
- 9. WAP for Fibonacci series.
- 10. WAP for reverse of a given number. Example: 531 → 135.
- 11. WAP to check whether a given number is a palindrome or not.
- 12. WAP to check whether a given number is a perfect number or not.
- 13. WAP to check whether a given number is a strong number or not.
- 14. WAP to check whether a given number is a prime number or not.
- 15. WAP to check whether a given number is an Armstrong number or not. Example: 153 = 1 + 125 + 27 = 153.
- 16. WAP to find the first 1000 perfect numbers.
- 17. WAP to find the first 1000 strong numbers.
- 18. WAP to find the first 1000 prime numbers.
- 19. WAP to find the first 1000 factorial numbers.
- 20. WAP to find the first 1000 palindrome numbers.
- 21. WAP for Factorial using Recursion.
- 22. WAP for prime number using Recursion.
- 23. WAP for perfect number using Recursion.
- 24. WAP for strong number using Recursion.
- 25. WAP for Fibonacci series using Recursion.
- 26. WAP to display individual digits of a given number. Example: 531 → 5, 3, 1.
- 27. WAP for multiplication of individual digits of a given number. Example: 420 → 4 × 2 × 0 = 0.
- 28. WAP for sum of individual digits of a given number. Example: 531 → 5 + 3 + 1 = 9.
29–57
29–57. Operators, Conditions & Loops
- 29. WAP for largest of 2 numbers.
- 30. WAP for largest of 3 numbers.
- 31. WAP for largest of 4 numbers.
- 32. WAP for largest of 3 numbers using Arithmetic and Relational Operators.
- 33. WAP for smallest of 2 numbers.
- 34. WAP for smallest of 3 numbers.
- 35. WAP for smallest of 4 numbers.
- 36. WAP for multiplication table of a given number.
- 37. WAP for multiplication table of N-number series. Example: N = 4 → display 1st, 2nd, 3rd and 4th tables.
- 38. WAP to check whether a given number is even or not.
- 39. WAP to check whether a given number is odd or not.
- 40. WAP to check whether a given number is even without using if.
- 41. WAP to check whether a given number is even using the ternary operator.
- 42. WAP to check whether a given number is even using switch.
- 43. WAP for sum of even number series.
- 44. WAP for sum of odd number series.
- 45. WAP for sum of N-number series.
- 46. WAP for swapping of 2 numbers.
- 47. WAP for swapping of 2 numbers without a temporary variable.
- 48. WAP for swapping of 2 numbers with a single statement.
- 49. WAP using for loop to display 1 to 10 numbers.
- 50. WAP using for loop to display 10 to 1 numbers.
- 51. WAP using while loop to display 1 to 10 numbers.
- 52. WAP using while loop to display 10 to 1 numbers.
- 53. WAP using do-while loop to display 1 to 10 numbers.
- 54. WAP using do-while loop to display 10 to 1 numbers.
- 55. WAP for sum series: 1 + 2 + 3 + … + n = n(n + 1)/2.
- 56. WAP for sum series: 1² + 2² + 3² + … + n² = n(n + 1)(2n + 1)/6.
- 57. WAP for sum series: 1³ + 2³ + 3³ + … + n³ = n²(n + 1)²/4.
58–69
58–69. Series, Functions & Patterns
- 58. WAP to check whether a, a+d, a+2d, a+3d, … are in A.P. Find nth term = a + (n−1)d and sum of n terms = (n/2)(2a + (n−1)d).
- 59. WAP to check a, ar, ar², … as a G.P. Find the nth term.
- 60. WAP for powers function without using pow() function.
- 61. WAP to find nPr value.
- 62. WAP to find nCr value.
- 63. WAP for square of a given number.
- 64. WAP to print the following output for n = 4: Number / Square / Cube → 1 1 1, 2 4 8, 3 9 27, 4 16 64.
- 65. WAP to print the series of numbers divisible by 10 up to 200(n). N should be passed at runtime.
- 66. WAP to print the number series from 1 to 7 and 0 to 7. Output: 1,2,3,4,5,6,7 ::: 0,1,2,3,4,5,6,7.
- 67. WAP to print the series: 1,2,3,4,5,6,7,6,5,4,3,2,1.
- 68. WAP to display the given number pyramid using loops: 1 / 2 3 / 4 5 6 / 7 8 9 10.
- 69. WAP to display the descending number pattern: 10 9 8 7 / 6 5 4 / 3 2 / 1.
70–80
70–80. Number & Star Patterns
- 70. Star pattern: increasing triangle (1, 2, 3, 4 stars).
- 71. Star pattern: decreasing/inverted triangle.
- 72. Star pattern: increasing triangle.
- 73. Star pattern: increasing triangle up to 4 rows.
- 74. Star pattern: increasing triangle up to 5 rows.
- 75. Star pattern: decreasing triangle.
- 76. Star pattern: mixed/inverted triangle pattern.
- 77. Number pattern: 1 2 3 4 5 4 3 2 1.
- 78. Number pyramid pattern: 1 1 / 1 2 2 1 / 1 2 3 3 2 1 / 1 2 3 4 4 3 2 1 / 1 2 3 4 5 4 3 2 1.
- 79. WAP to reverse numbers using the shown logic: 12 → 21, 144 → 441. Rev(144) = 441. Write the logic of the program.
- 80. WAP to find the series based on the above reverse-number logic up to 1000.
81–96
81–96. Numbers, Words, Grade & Conversion
- 81. WAP to find the second largest of given numbers.
- 82. WAP for a given number such as 896 to print: eight nine six.
- 83. WAP to display a given number in words. Example: 120 = One Twenty.
- 84. WAP to display a given number in words. Example: 12,531 = Twelve thousand and Five hundred and thirty one.
- 85. WAP to display and complete the student-grade program. Variables: Sno, sname, m1, m2, m3. All fields should be non-null, then find the grade.
- Grade rules: 75% → Distinction; 60%–74% → I Class; 45%–59% → II Class; 35%–44% → III Class; 0%–34% → Fail.
- 86. WAP for LCM of two numbers.
- 87. WAP to convert decimal to binary.
- 88. WAP to convert binary to decimal.
- 89. WAP to convert octal to decimal.
- 90. WAP to convert decimal to octal.
- 91. WAP to convert hexadecimal to binary.
- 92. WAP to convert decimal to hexadecimal.
- 93. WAP to find whether a given number is positive, negative or neutral.
- 94. WAP to find the power-unit rate. House: 1 unit = ₹3; Shopping complex: 1 unit = ₹14; Software company: 1 unit = ₹24. Display Item, Units and Total Price.
- 95. WAP for Pascal Triangle.
- 96. WAP for increment operator. Given expression: a=1; a++; ++a; b=(a++)+(++a)+(++a)+(a++)-(a)+(a--)+(a++)+(++a)-(--a)+(++a); System.out.println(b);
97–105
97–105. Arrays
- 97. WAP to find/display the elements in an array.
- 98. WAP for sum of array elements.
- 99. WAP for addition of two arrays.
- 100. WAP for subtraction of two arrays.
- 101. WAP to find the largest element in an array.
- 102. WAP to display elements in a character array.
- 103. WAP to find the index value when an element is given in an array.
- 104. WAP for sorting an array.
- 105. WAP for Bubble Sort.
106–120
106–120. Series, Trigonometry, Matrix & Date
- 106. Evaluate the series: 1 + 1/x! + 1/x²! + 1/x³! + …, where n and x are input values.
- 107. Evaluate the series: 1 − 1/x! + 1/x²! − 1/x³! + …, where n and x are input values.
- 108. WAP using switch to compute arithmetic operations.
- 109. WAP to evaluate the SIN(θ) series up to a given θ value in degrees. Also consider sin(), cos(), tan(), cot(), sec(), cosec() for 0°, 30°, 45°, 60° and 90°.
- 110. WAP demonstrating break and continue using a for loop: a) if (i == j) continue; b) if (i == j) break.
- 111. WAP to check whether a given year is a leap year or not.
- 112. WAP to find the leap-year list from 1960 to 2020.
- 113. WAP to display matrix elements.
- 114. WAP for matrix addition.
- 115. WAP for matrix multiplication.
- 116. WAP for matrix subtraction.
- 117. WAP for matrix division (elements in the matrix should be non-null).
- 118. WAP to find the index of a matrix element when the element is given.
- 119. WAP to find the element for a given matrix index.
- 120. WAP to display the day-of-week name for a given date.
★
Star Pattern Gallery
The source document shows the visual star-pattern exercises on pages 9–10. They are recreated below as lightweight HTML/CSS previews rather than inserting the original PDF pages.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Square Star Pattern
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Hollow Square Star Pattern with Diagonal
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Rhombus Star Pattern
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Hollow Rhombus Star Pattern
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Mirrored Rhombus Star Pattern
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Hollow Mirrored Rhombus Star Pattern
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Right Triangle Star Pattern
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * * *Mirrored Right Triangle Star Pattern
* * * * * * * * * * * * * * * * * * * * * * * *
Hollow Right Triangle Star Pattern
*
* *
* *
* *
* *
* *
* *
* *
* * * * * * * * *Hollow Mirrored Right Triangle Star Pattern
* * * * * * * * *
* *
* *
* *
* *
* *
* *
* *
*Hollow Inverted Mirrored Right Triangle Star Pattern
* * * * * * * * * * * * * * * * * * * * * * * *
Hollow Inverted Right Triangle Star Pattern
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Inverted Right Triangle Star Pattern
* * * * * * * * *
* * * * * * * *
* * * * * * *
* * * * * *
* * * * *
* * * *
* * *
* *
*Inverted Mirrored Right Triangle Star Pattern
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Hollow Square Star Pattern
*
*
* * *
* * *
* * * * *
* * * * *
* * * * * * *
* * * * * * *
* * * * * * * * *Pyramid Star Pattern
*
* *
* *
* *
* * * * * * * * *Hollow Pyramid Star Pattern
* * * * * * * * *
* * * * * * *
* * * * * * *
* * * * *
* * * * *
* * *
* * *
*
*Inverted Pyramid Star Pattern
* * * * * * * * *
* *
* *
* *
*Hollow Inverted Pyramid Star Pattern
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
* * * * * * *
* * * * * *
* * * * *
* * * *Right Arrow Star Pattern
* * * * * * * * * * * * * * * * * * * * * * * * *
Half Diamond Star Pattern
* * * * * * * * * * * * * * * * * * * * * * * * *
Left Arrow Star Pattern
*
*
*
*
* * * * * * * * *
*
*
*
*Plus Star Pattern
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
* * * * * * *
* * * * *
* * *
*Diamond Star Pattern
* *
* *
* *
* *
*
* *
* *
* *
* *