1.
Sum of Digits
Write a method int sumDigits(int number) that returns the sum of its digits.
Example: sumDigits(1234) returns 10
2. Maximum of Three Numbers
Write a method int max(int a, int b, int c) that returns the largest of three integers.
Example: max(3, 7, 5) returns 7
3. Prime Number Checker
Write a method boolean isPrime(int number) that returns true if the number is prime.
Example: isPrime(7) returns true, isPrime(8) returns false
4. Reverse an Array
Write a method void reverseArray(int[] array) that reverses the elements of an array in place.
Example: {1, 2, 3} becomes {3, 2, 1}
5. Count Even and Odd Numbers
Write a method that takes an integer array and prints the count of even and odd numbers.
6. Simple Grading System
Write a method that accepts a score (0–100) and prints the grade according to the scale: A (90+),
B (80–89), C (70–79), F (<70).
Use if-else statements.
7. Palindrome Number
Write a method boolean isPalindrome(int number) to check if an integer reads the same forward
and backward.
Example: 121 is a palindrome.
8. Multiplication Table
Write a method that accepts an integer and prints its multiplication table from 1 to 10.
9. Simple Bank Account Class
Create a class BankAccount with fields for balance. Add methods for deposit(double amount),
withdraw(double amount), and displayBalance().
10. Largest Element in Array
Write a method that accepts an integer array and returns the largest number.
11. Factorial Calculator
Write a method int factorial(int number) that returns the factorial of a number.
Example: factorial(5) returns 120