• 09 October

    Find first and last digit of a number

    In this article, we are going to find first and last digit of a number. To find first and last digit of any number, we can have several ways like using modulo operator or pow() and log() methods of Math class etc. Let’s see some examples. Before moving to example, let’s first create an algorithm […]

  • 03 October

    Happy Number program in Java

    In this article, we are going to learn to find Happy Number using Java. Let’s first understand, what is Happy Number? What is a Happy Number? A number which leaves 1 as a result after a sequence of steps and in each step number is replaced by the sum of squares of its digit. For […]

  • 30 September

    Find Perfect Number in Java

    In this article, we are going to find whether a number is perfect or not using Java. A number is called a perfect number if the sum of its divisors is equal to the number. The sum of divisors excludes the number. There may be several approaches to find the perfect number. For example: 28 […]

  • 28 September

    How to find Magic Number in Java

    In this article, we are going to learn to find Magic Number using Java. Let’s first understand, what is Magic Number? What is a Magic Number? A number which leaves 1 as a result after a sequence of steps and in each step number is replaced by the sum of its digits. For example, if […]

  • 28 September

    Number guessing game in java

    In this article, we will implement Number guessing game in java. The number guessing game is based on a concept where player guesses a number between a range. If player guesses the exact number then player wins else player looses the game. Since this game provides limited attempts, so, player must guess the number with […]

  • 18 September

    Return second last digit of given number

    In this topic, we will learn to get the second last digit of a number with the help of examples. There can be several ways to get second last digit; here we are discussing some solutions. Using modulo operator Here, we are using modulo and divide operators to find the second last digit. The modulo […]

  • 10 October

    Java program to print table of number

    In this post we will see how to print table of number in java. It is good program to practice for loop in java. [crayon-662b42616e36f327679977/] Output: Enter a Number : 8 Table of 8 is 8 * 1 = 8 8 * 2 = 16 8 * 3 = 24 8 * 4 = 32 […]

  • 06 October

    Java isNumeric method

    In this post, we will see how to implement isNumeric method in java. There are many way to check if String is numeric or not. Let’s see one by one. Using regular expressions You can use below regular expression to check if string is numeric or not. [-+]?\\d*\\.?\\d+ [crayon-662b42616e4de166893353/] Output: 223 is numeric : true […]

  • 30 March

    Implement isPrime method in java

    In this post, we will implement isPrime method. isPrime method will take an integer as input and determine whether the number is prime or number. A prime number is a number which has only two divisors 1 and itself. To check if the number is prime or not, we need to see if it has any […]