Java Calculate Percentage

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. So, let’s dig in,

Example: Java Calculate Percentage

Also ReadĀ – Calculate Average of an Array in Java

import java.util.Scanner;

public class calculate_Percentage {

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

About the author


View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *