• 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-6729acc278766182963185/] Output: Enter a Number : 8 Table of 8 is 8 * 1 = 8 8 * 2 = 16 8 * 3 = 24 8 * 4 = 32 […]

  • 09 October

    Java program to calculate grade of students

    In this post, we will see how to calculate grade of students in java. Student’s grade is decided by average of marks.It is good program to practice execution of if statements in java. Here is simple program to calculate grade of students [crayon-6729acc2787e5146506870/] Output: Enter Marks for 5 Subjects : 50 60 70 80 90 […]

  • 09 October

    Find Vowels in a String

    In this post, we will see how to find and count vowels in a string. Find Vowels in a String If any character in String satisfy below condition then it is vowel and we will add it to Hashset. character==’a’ || character==’A’ || character==’e’ || character==’E’ || character==’i’ || character==’I’ || character==’o’ || character==’O’ || […]

  • 06 October

    Implement distance formula in java

    In this post, we will see how to implement distance formula between two points in java. Formula to find distance between two points ( x1, y1) and (x2 , y2) is d= sqrt( (x2-x1)^2+ (y2 – y1)^2) Here is simple program to calculate distance between two points in java. [crayon-6729acc27895a123143595/] Here we have used math.sqrt […]

  • 06 October

    Convert decimal to binary in java

    In this post, we will see how to convert decimal to binary in java. There are lot of ways to convert decimal to binary in java.Let’s explore them one by one. Using Integer.toBinaryString() method You can simply use inbuilt Integer.toBinaryString() method to convert a decimal [crayon-6729acc2789f2951296891/] Output: Binary representation of 12 : 1100 Binary representation […]