-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCh01_05_PracticeCBSEPercent.java
More file actions
27 lines (25 loc) · 1.11 KB
/
Ch01_05_PracticeCBSEPercent.java
File metadata and controls
27 lines (25 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.Scanner;
public class Ch01_05_PracticeCBSEPercent {
public static void main(String[] args) {
Scanner n1 = new Scanner(System.in);
System.out.println("Welcome to CBSE Percentage Calculator");
System.out.print("Enter your Name: ");
String n2 = n1.nextLine();
System.out.println("Greetings! "+n2);
System.out.println("Enter the obtained marks as asked below:");
Scanner marks = new Scanner(System.in);
System.out.print("Enter your Physics Marks: ");
float P = marks.nextFloat();
System.out.print("Enter your Chemistry Marks: ");
float C = marks.nextFloat();
System.out.print("Enter your Mathematics Marks: ");
float M = marks.nextFloat();
System.out.print("Enter your Physical Education Marks: ");
float PE = marks.nextFloat();
System.out.print("Enter your English Marks: ");
float E = marks.nextFloat();
float total = P+C+M+PE+E;
float percentage = (total/500)*100;
System.out.print("Well Done Student! Your Obtained Percentage is: "+ percentage);
}
}