Java Number Programs

Master fundamental Java concepts with these beginner-friendly programs

Hello, World!

The traditional first program in any programming language that demonstrates basic syntax.

Add Two Numbers

Learn how to perform basic arithmetic operations and variable assignment in Java.

Find Even or Odd

Understand conditional statements and the modulus operator in Java.

Find the Largest Number

A program to compare two numbers and find the larger one using conditional logic.

Simple Interest Calculation

A program to calculate simple interest using the formula SI = (P × R × T) / 100.

Check Leap Year

A program to check whether a given year is a leap year.

Swap Without Third Variable

A program to swap two numbers without using a third variable.

Factorial of a Number

A program to find the factorial of a number.

Reverse a Number

A program to reverse a given number.

Sum of Digits

A program to find the sum of digits of a number.

Check Prime Number

A program to check whether a number is prime or not.

Multiplication Table

A program to print the multiplication table of a given number.

Largest of Three Numbers

A program to find the largest of three numbers.

Palindrome Number

A program to check whether a number is a palindrome.

Fibonacci Series

A program to print the Fibonacci series up to N terms.

Armstrong Number

A program to check whether a number is an Armstrong number.

Perfect Number

A program to check whether a number is a Perfect number.

Strong Number

A program to check if a number is a Strong number.

Automorphic Number

A program to check if a number is Automorphic (its square ends with the number itself).

Harshad Number

A program to check if a number is a Harshad number (divisible by the sum of its digits).

Duck Number

A program to check whether a number is a Duck number (contains at least one zero but not at the beginning).

Neon Number

A program to check whether a number is a Neon number (sum of digits of square of the number equals the number).

Kaprekar Number

A program to check whether a number is a Kaprekar number (sum of parts of its square equals the number).

Magic Number

A program to check if a number is a Magic number (repeated sum of digits results in 1).

HCF (GCD)

A program to find the HCF (GCD) of two numbers.

Automorphic Number

Check whether a number is an Automorphic number.

Peterson Number

Check whether a number is a Peterson number.

Sunny Number

Check whether a number is a Sunny number.

Fascinating Number

Check whether a number is a Fascinating number.

Keith Number

Check whether a number is a Keith number.

Neon Number

Check whether a number is a Neon number.

Spy Number

Check whether a number is a Spy number.

ATM Program

Simulate basic ATM operations using a menu-driven approach.

Autobiographical Number

Check whether a number is an Autobiographical number.

Emirp Number

Check whether a number is an Emirp number.

Sphenic Number

Check whether a number is a Sphenic number.

Buzz Number

Check whether a number is a Buzz number.

Evil Number

Check whether a number is an Evil number.

ISBN Number

Validate a 10-digit ISBN number.

Krishnamurthy Number

Check whether a number is a Krishnamurthy number.

Bouncy Number

Check whether a number is a Bouncy number.

Mystery Number

Check whether a number is a Mystery number.

Smith Number

Check whether a number is a Smith number.

Strontio Number

Check whether a number is a Strontio number.

Xylem and Phloem Number

Check whether a number is a Xylem or Phloem number.

nth Prime Number

Find the nth prime number.

Alternate Prime Numbers

Display alternate prime numbers up to a limit.

Square Root Without sqrt Method

Find the square root of a number without using the sqrt() method.

Swap Two Numbers Using Bitwise Operator

Swap two numbers using the bitwise XOR operator.

GCD of Two Numbers

Find the Greatest Common Divisor (GCD) of two numbers.

Largest of Three Numbers

Find the largest among three numbers.

Smallest of Three Numbers Using Ternary Operator

Find the smallest among three numbers using ternary operator.

Check if Number is Positive or Negative

Check whether a given number is positive, negative, or zero.

Perfect Square Check

Check whether a number is a perfect square.

Even Numbers From 1 to 100

Display even numbers from 1 to 100.

Odd Numbers From 1 to 100

Display odd numbers from 1 to 100.

Sum of Natural Numbers

Find the sum of the first n natural numbers.