• 05 October

    Calculate total surface area of Cylinder in java

    In this post, we will see how to calculate total surface area of Cylinder in java. Formula of calculating total surface area of Cylinder is: Surface area of Cylinder = 2 *Π * r * r + 2 *Π * r * h Where r is radius of cylinder and h is height of cylinder […]

  • 05 October

    Calculate total surface area of Hemisphere in java

    In this post, we will see how to calculate total surface area of Hemisphere in java. Hemisphere is exactly half of sphere. There can be many practical examples of Hemisphere. You can divide earth into two hemisphere i.e. Northen Hemisphere and Southern Hemisphere. Formula of calculating total surface area of Hemisphere is: surface area of […]

  • 05 October

    Print prime numbers from 1 to 100 in java

    In this program, we will print prime numbers from 1 to 100 in java. 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 other factors other than 1 or itself. If it has, […]

  • FizzBuzz Java
    31 March

    FizzBuzz program in java

    In this post, we will see how to program FizzBuzz in java. Fizzbuzz is a fun game played generally by school children. It is simple game in which when your turn comes, you need to say the next number. So here are rules of the game: If number is divisible by 3, then you need […]

  • 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 […]

  • 10 March

    Print pyramid pattern: 1 3*2 4*5*6 pattern in java

    In this post, we will see how to print the following pyramid pattern. Problem Input : n = 4 Output : 1 3*2 4*5*6 10*9*8*7Input : n = 5 Output : 1 3*2 4*5*6 10*9*8*7 11*12*13*14*15 Solution If you notice the pattern we need to print odd rows in increasing order and even rows in […]

  • 05 February

    Java program to find permutation and combination (nCr nPr)

    In this tutorial, we will see java program to find permutation and combination. Permutation is represented as nPr and Combination is represented as nCr.It is simple program which involves factorial of the numbers. Here is formula to find permutation and combination (nCr nPr). nPr = factorial(n) / factorial(n-r) nCr = factorial(n)/(factorial(n-r) * factorial(r)) [crayon-66062ff0da621307879032/] Output: Enter […]

  • 22 January

    Matrix multiplication in java

    In this post, we will see how to multiply two matrices in java. [crayon-66062ff0dafb7330893111/] Output: Enter number of rows and columns of first matrix : 2 2 Enter first matrix elements : 2 4 6 8 Enter number of rows and columns of second matrix :2 2 Enter second matrix elements : 3 6 9 […]

  • 22 January

    Java program to add two matrices

    In this post, we will see how to add two matrices in java.I am giving example for 33 matrix. You can extend it to nn matrices. [crayon-66062ff0db0a3717385742/] Output: Enter matrix 1 elements : 11 22 33 44 55 66 77 88 99 Enter matrix 2 elements : 10 20 30 40 50 60 70 80 […]