Java Program for Palindrome Number

Here you will get java program for palindrome number. A number is said palindrome if its is equal to its reverse. For example, 131 is palindrome while 123 is not. Below I have shared two ways to check palindrome in java. Java Program for Palindrome Number Method 1: In this method we will reverse the number and then compare it with original number.

Output Enter a number: 121 Number is Palindrome   Method 2: In this method we will

Read more

Fibonacci Series in Java Using Loop and Recursion

Here you will get program for fibonacci series in java using loop and recursion. The series in which next term is calculated by adding previous two terms is called fibonacci series. Example: 0 1 1 2 3 5 8 13 21 34 Program for Fibonacci Series in Java Using Loop

Output How many terms? 10 0 1 1 2 3 5 8 13 21 34 Program for Fibonacci Series in Java Using Recursion

  Comment below if you have doubts or

Read more

Java Program to Reverse a Number

Here you will get java program to reverse a number with while loop and recursion. When we divide a number with 10 then the remainder is the last digit of number and quotient is the number without last digit. / operator is used find quotient and % operator is used to find remainder. We use this concept to reverse the number. Example: Initially n = 123, reverse = 0 Step 1: remainder = n % 10 = 123 % 10

Read more

Java Program for Leap Year

Here you will get java program for leap year. Condition for Leap Year A year completely divisible by 400 is leap year. A year completely divisible by 4 but not divisible by 100 is leap year. For example: 2000, 2008, etc are leap year while 1900, 1997, etc are not leap year. Java Leap Year Program

  Output Enter a year (Ex: 1990): 1996 leap year Enter a year (Ex: 1990): 1900 not leap year

Read more

Java Program to Find Largest of Three Numbers

Here you will get java program to find largest of three numbers using if else statements.

  Output Enter three numbers: 4 10 5 Largest number is 10

Read more

Java Program to Check Even or Odd Number

Here you will get java program to check even or odd number. How to check? If number is completely divisible by 2 then it is even otherwise odd. In our program we will find the remainder of number by dividing it by 2 using modulus (%) operator. If remainder is 0 then number is even else odd. Java Program to Check Even or Odd Number

  Output Enter a number: 4 even number

Read more

Java Program to Calculate Area and Circumference of Circle

Here you will get java program to calculate area and circumference of circle. Formula used: Area of Circle = 3.14 * radius2 Circumference of Circle = 2 * 3.14 * radius

  Output Enter radius: 3.5 Area = 38.465 Circumference = 21.98

Read more

Java Program to Swap Two Numbers Without Using Third Variable

Here you will get java program to swap two numbers without using third variable or temporary variable. We can do this in 3 ways as mentioned below. Also Read: Java Program to Swap Two Numbers Using Temporary Variable   1. Using Addition & Subtraction Operator We can swap two numbers using addition (+) and subtraction (-) operator.

Output Before swap: a = 5 b = 6 After swap: a = 6 b = 5   2. Using Multiplication & Division

Read more
1 2 3 4 5