• 01 August

### How to swap two numbers without using temporary variables in java

In this post, we will see how to swap two numbers without using temporary variables. There are three ways to do it. Java program: [crayon-61a2c8f6365aa192546774/] When you run above program, you will get following output: [crayon-61a2c8f6365b6920025869/] Third way is fastest of all. Please go through Interview programs in java  for more such programs.

• 15 December

### How to find GCD and LCM of two numbers in java

In this post, we will see how to find Greatest common divisor(GCD) and Least Common Multiple(LCM) in java. GCD is calculated using Euclidean algorithm and LCM is calculated using reduction by GCD Eucid algo for calculating GCD is: Lets say , there are two numbers , a and b so GCD of two numbers = […]

• 10 July

### How to find prime factors of a number in java

In this post, we will see how to find prime factors of a number in java. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The prime factors of a number are all of the prime numbers that will exactly divide the given number. […]

• 09 July

### java program to check prime number

This is easy question. It may not be asked you directly, but you can use this program to create many other complex program. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Program logic: If any number which is not divisible by any other […]