From 41198d8539e944f48b10eced671f030566d89e63 Mon Sep 17 00:00:00 2001 From: amitdudhankar <72137523+amitdudhankar@users.noreply.github.com> Date: Wed, 30 Sep 2020 18:02:48 +0530 Subject: [PATCH] Percentage Calculator I've added a program of percentage calculator in java. --- percentage_calculator.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 percentage_calculator.java diff --git a/percentage_calculator.java b/percentage_calculator.java new file mode 100644 index 0000000..152af39 --- /dev/null +++ b/percentage_calculator.java @@ -0,0 +1,23 @@ +package com.company; +import java.util.Scanner; + +public class percentage_calculator { + public static void main(String[] args) { + System.out.println("This is the percentage calculator of the CBSE Board for 5 subjects: "); + Scanner scan = new Scanner(System.in); + System.out.println("Enter the Marks of the subject 'English': "); + int marks1 = scan.nextInt(); + System.out.println("Enter the Marks of the subject 'Mathematics': "); + int marks2 = scan.nextInt(); + System.out.println("Enter the Marks of the subject 'Science': "); + int marks3 = scan.nextInt(); + System.out.println("Enter the Marks of the subject 'Social Science': "); + int marks4 = scan.nextInt(); + System.out.println("Enter the Marks of the subject 'Marathi': "); + int marks5 = scan.nextInt(); + float total = marks1 + marks2 + marks3 + marks4 + marks5; + System.out.println("The total of the marks is: "+total); + float percentage = (total/500)*100; + System.out.println("The percentage of the student according to the scored marks is: "+percentage); + } +}