The document presents a collection of over 50 Java programming questions organized by concept, focusing on topics such as Armstrong numbers and palindromes. It includes example code snippets demonstrating the use of loops to solve these problems, along with various related challenges. The document serves as a resource for practicing Java programming skills through problem-solving.
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 ratings0% found this document useful (0 votes)
4 views
Java Programming Questions
The document presents a collection of over 50 Java programming questions organized by concept, focusing on topics such as Armstrong numbers and palindromes. It includes example code snippets demonstrating the use of loops to solve these problems, along with various related challenges. The document serves as a resource for practicing Java programming skills through problem-solving.
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
You are on page 1/ 1
50+ Java Programming Questions by Concept
Example (For loop):
public class Armstrong {
public static void main(String[] args) { int num = 153, original = num, sum = 0; while (num > 0) { int digit = num % 10; sum += digit * digit * digit; num /= 10; } System.out.println(original == sum ? "Armstrong" : "Not Armstrong"); } } Problems: 1. Check Armstrong number using while loop. 2. Armstrong number for 4-digit input. 3. Find all Armstrong numbers between 1-1000. 4. Armstrong using do-while. 5. Count Armstrong numbers in a given range.
Example (While loop):
public class Palindrome {
public static void main(String[] args) { int num = 121, rev = 0, temp = num; while (num > 0) { rev = rev * 10 + num % 10; num /= 10; } System.out.println(temp == rev ? "Palindrome" : "Not Palindrome"); } } Problems: 1. Palindrome using for loop. 2. Check if string is palindrome. 3. Palindrome using do-while. 4. Count palindrome numbers in a range. 5. First N palindrome numbers.