-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmarks_calculator.java
More file actions
38 lines (31 loc) · 1.11 KB
/
marks_calculator.java
File metadata and controls
38 lines (31 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
28
29
30
31
32
33
34
35
36
37
38
// Calculate Student percentage and marks
import java.util.Scanner;
class Student_Marks_Calculator_by_Amanjain
{
public static void main(String args[])
{
float S1 , S2 , S3, S4 , S5;
double total, average, percentage;
Scanner op=new Scanner(System.in);
/* Input marks of all five subjects */
System.out.println("Enter marks of five subjects:");
System.out.print("Enter marks of English subjects:");
S1=op.nextFloat();
System.out.print("Enter marks of physics subjects:");
S2=op.nextFloat();
System.out.print("Enter marks of chemistry subjects:");
S3=op.nextFloat();
System.out.print("Enter marks of maths subjects:");
S4=op.nextFloat();
System.out.print("Enter marks of computers subjects:");
S5=op.nextFloat();
/* Calculate total, average and percentage */
total = S1 + S2 + S3 + S4 + S5;
average = (total / 5.0);
percentage = (total / 500.0) * 100;
/* Print all results */
System.out.println("Total marks ="+total);
System.out.println("Average marks = "+average);
System.out.println("Percentage = "+percentage);
}
}