This repository contains 7 additional Java problems that go beyond the basics, helping learners strengthen their logical thinking and problem-solving skills.
Problem: Write a Java program that counts the number of vowels and consonants in a given string.
Example:
Input: "Hello World"
Output: Vowels: 3, Consonants: 7
Problem: Write a Java program to convert a decimal number to binary.
Example:
Input: 10
Output: 1010
Problem: Write a Java program to find the second largest number in a given array.
Example:
Input: [12, 35, 1, 10, 34, 1]
Output: 34
Problem: Write a Java program that takes a string and a character as input and counts how many times the character appears in the string.
Example:
Input: "banana", 'a'
Output: 3
Problem: Write a Java program to find the greatest common divisor (GCD) of two numbers using a loop.
Example:
Input: 36, 60
Output: 12
Problem: Write a Java program to reverse an array without using an extra array.
Example:
Input: [1, 2, 3, 4, 5]
Output: [5, 4, 3, 2, 1]
Problem: Write a Java program to check whether a number is an Armstrong number (sum of the cubes of its digits equals the number itself).
Example:
Input: 153
Output: Armstrong Number
(1³ + 5³ + 3³ = 153)