• 20 January

    Java program to calculate arithmetic mean

    In this tutorial, we will see simple java program to calculate arithmetic mean. Here is simple algorithm to calculate arithmetic mean. Calculate sum of elements in the array Divide it by total number of element in the array. [crayon-607bef6c4901f468681113/] Output: Please enter count of numbers you want to Enter ? 5 Enter 5 Numbers : […]

  • 20 January

    Java program to count positive, zero and negative numbers

    In this post, we will see Java program to count positive, zero and negative numbers [crayon-607bef6c498fa770873000/] Output: Enter 10 Numbers : 10 0 45 -10 67 0 76 -33 64 -92 5 Positive Numbers 3 Negative Numbers 2 Zero That’s all about Java program to count positive, zero and negative numbers

  • 20 January

    Java program to count number of words in sentence

    In this tutorial, we will see a simple java program to count number of words in sentence. [crayon-607bef6c49e01467744478/] Output: Enter a Sentence : Java2Blog is a technical blog. Total number of words are 5 That’s all about Java program to count number of words in sentence.

  • 20 January

    Java program to print Diamond pattern

    In this tutorial, we will see java program to print diamond pattern. [crayon-607bef6c4a23a691581127/] That’s all about printing diamond pattern in java.

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

  • 19 January

    Java program to compare two Strings

    In this post, we will see how to compare two String in java. As you might know, String implements Comparable interface, you can use compareTo method to compare two String in java. [crayon-607bef6c4ac6f644460182/] Output: Enter First String : Java Enter Second String : Blog First String is Greater than Second String. That’s all about comparing […]

  • 19 January

    Java program for sum of digits of number

    In this post, we will see how to find sum of digits of number in java. You can find unit’s place digit by number%10, add it to the total and divide the number by 10 to remove the unit’s place. [crayon-607bef6c4afb1433639691/] Output: Enter a Number : 5385 Sum of digits of number 5385 is 21 […]

  • 19 January

    Java program to calculate average marks

    In this post, we will see simple java program to find average and percentage marks. We have taken average and percentage of five subject marks below. [crayon-607bef6c4b2e3951005243/] Output: Enter marks for 5 Subjects : 91 57 83 69 74 Average Marks = 74.8 Percentage = 74.8% That’s all about Java program to calculate average and […]

  • 19 January

    Java program to make simple calculator

    In this post, we will see how to create a simple calculator in java. This calculator program performs 4 basic operatios – Addition, Substraction, Multiplication and division.It uses Switch case to choose operation you want to perform. [crayon-607bef6c4b61c893089538/] Output: 1. Addition 2. Subtraction 3. Multiplication 4. Division 5. ExitEnter your operation : 3 Enter Two […]