Skip to content

Cubicl3s/app-dev-task.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Java Beginner Problems

This repository contains 15 simple Java problems designed to help beginners build logic and improve their programming skills.

Problems

1. Print "Hello, World!"

Problem: Write a Java program that prints "Hello, World!" to the console.


2. Sum of Two Numbers

Problem: Write a Java program that takes two numbers as input and prints their sum.

Example:

Input: 5, 10  
Output: 15  

3. Check Even or Odd

Problem: Write a Java program to check whether a number is even or odd.

Example:

Input: 7  
Output: Odd  

4. Find the Largest Number

Problem: Write a Java program to find the largest number among three given numbers.

Example:

Input: 5, 12, 7  
Output: 12  

5. Print Numbers from 1 to 10

Problem: Write a Java program to print numbers from 1 to 10 using a loop.

Output:

1 2 3 4 5 6 7 8 9 10  

6. Calculate Factorial

Problem: Write a Java program to find the factorial of a number.

Example:

Input: 5  
Output: 120  

(Factorial of 5 = 5 × 4 × 3 × 2 × 1 = 120)


7. Reverse a Number

Problem: Write a Java program to reverse a given number.

Example:

Input: 1234  
Output: 4321  

8. Check for Prime Number

Problem: Write a Java program to check whether a number is prime or not.

Example:

Input: 7  
Output: Prime  

9. Print Multiplication Table

Problem: Write a Java program to print the multiplication table of a given number.

Example:

Input: 5  
Output:  
5 x 1 = 5  
5 x 2 = 10  
...  
5 x 10 = 50  

10. Check if a Number is Palindrome

Problem: Write a Java program to check whether a number is a palindrome.

Example:

Input: 121  
Output: Palindrome  

(A palindrome is a number that reads the same backward as forward.)


11. Count Digits in a Number

Problem: Write a Java program to count the number of digits in a given number.

Example:

Input: 12345  
Output: 5  

12. Find Sum of Digits

Problem: Write a Java program to find the sum of digits of a given number.

Example:

Input: 123  
Output: 6  

(Sum = 1 + 2 + 3 = 6)


13. Swap Two Numbers Without Using a Third Variable

Problem: Write a Java program to swap two numbers without using a third variable.

Example:

Input: a = 5, b = 10  
Output: a = 10, b = 5  

14. Print Fibonacci Series

Problem: Write a Java program to print the Fibonacci series up to n terms.

Example:

Input: 7  
Output: 0 1 1 2 3 5 8  

(Fibonacci series: Each number is the sum of the two preceding ones.)


15. Find the Power of a Number

Problem: Write a Java program to calculate the power of a number using a loop.

Example:

Input: 2^3  
Output: 8  

Note : Do not use Chat gpt and other AI tools to solve and complete the task no. 1

About

"Day : Sunday | Date : 9 March, 2025"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published