• 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-6729cf5a5a098164973203/] 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’ || […]

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

  • 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-6729cf5a5a6f3853428593/] Output: Enter […]

  • 22 January

    Matrix multiplication in java

    In this post, we will see how to multiply two matrices in java. [crayon-6729cf5a5a7ce629132186/] 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-6729cf5a5a85a707948790/] 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 […]

  • 22 January

    Java program to subtract two matrices

    In this post, we will see how to subtract two matrices in java.I am giving example for 33 matrix. You can extend it to nn matrices. [crayon-6729cf5a5a915254079626/] 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 […]