Menu



Java program for calculating percentage


Percentage.java

import java.util.Scanner;
public class Percentage
{
public static void main(String[] args)
{
int total, score;
int percentage;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the total amount of score: ");
total = sc.nextInt();
System.out.println("Enter the score obtained: ");
score = sc.nextInt();
percentage = (score * 100/ total);
System.out.println("The percentage is = " + percentage + " %");
}
}










Connection failed: SQLSTATE[28000] [1045] Access denied for user 'studentdb'@'localhost' (using password: YES)

Subscribe