Java Calculate Percentage

Sharing is healthy !!

OK, today we going to talk aboutĀ java calculate percentage.

Well, the word percentage was familiar when we were in tenth and twelfth grades.

Calculating percentage was very crucial and important to get scholarships in top universities.

Well, now we will see a program in java to demonstrate how to calculate percentage in java. So, let’s dig in,

Example: Java Calculate Percentage

Also ReadĀ – Calculate Average of an Array in Java

import java.util.Scanner;

public class CalculatePercentage
   public static void main(String[] args)
      double a = 0;
      double b = 0;
      Scanner sc = new Scanner(;
      System.out.println("Please enter value a: ");
      a = sc.nextDouble();
      System.out.println("Please enter value b: ");
      b = sc.nextDouble();
      System.out.println("The percentage is: (a % of b): ");
      double result = a * b / 100;
      System.out.println(a + " % of " + b + " is " + result);


Java Calculate Percentage


So this is all about calculating percentage in java. I hope you have understood the java program.

You can subscribe to my blog flower brackets if you haven’t already.

Do share this post if you like.

Sharing is healthy !!