Skip to content

Cubicl3s/app-dev-task.4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Java Intermediate Problems

This repository contains 7 additional Java problems that go beyond the basics, helping learners strengthen their logical thinking and problem-solving skills.

Problems

1. Count Vowels and Consonants in a String

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  

2. Convert Decimal to Binary

Problem: Write a Java program to convert a decimal number to binary.

Example:

Input: 10  
Output: 1010  

3. Find the Second Largest Number in an Array

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  

4. Count the Occurrences of a Character in a String

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  

5. Find the GCD of Two Numbers

Problem: Write a Java program to find the greatest common divisor (GCD) of two numbers using a loop.

Example:

Input: 36, 60  
Output: 12  

6. Reverse an Array

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]  

7. Check if a Number is an Armstrong Number

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)


About

"Day : Monday | Date : 24 March, 2025"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published