From de86e2bead4023ce0d2b7c09e88c1fb93fe38b2d Mon Sep 17 00:00:00 2001 From: vanshika <82704514+jainvanshi3105@users.noreply.github.com> Date: Sat, 12 Feb 2022 17:43:00 +0530 Subject: [PATCH] percentage calculation percentage calculation of marks of 5 subjects along with the respective grades. --- Percentage Calculation | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Percentage Calculation diff --git a/Percentage Calculation b/Percentage Calculation new file mode 100644 index 0000000..c593502 --- /dev/null +++ b/Percentage Calculation @@ -0,0 +1,35 @@ +import java.util.*; +public class Percentage +{ + + public static void main(String[] args) + { + Scanner sc=new Scanner(System.in); + System.out.println("enter the marks of 5 subjects out of 100:"); + float a=sc.nextFloat(); + float b=sc.nextFloat(); + float c=sc.nextFloat(); + float d =sc.nextFloat(); + float e=sc.nextFloat(); + float percentage=((a+b+c+d+e)/500)*100; + System.out.println("percentage:"+percentage); + if(percentage<100 && percentage>80) + { + System.out.println("grade is A"); + } + else if(percentage>60 && percentage<79) + { + System.out.println("grade is B"); + } + else if(percentage>44 && percentage<59) + { + System.out.println("grade is C"); + } + else + { + System.out.println("grade is D"); + } + + } + +}