-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
31 lines (25 loc) · 805 Bytes
/
Main.java
File metadata and controls
31 lines (25 loc) · 805 Bytes
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
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("enter student name: ");
String name = input.nextLine();
System.out.print("enter marks(0 - 100): ");
int marks = input.nextInt();
String grade;
if (marks >= 80) {
grade = "A";
} else if (marks >= 60) {
grade = "B";
} else if (marks >= 50) {
grade = "C";
} else if (marks >= 40) {
grade = "D";
} else {
grade = "F";
}
System.out.println("\nname: " + name);
System.out.println("marks: " + marks);
System.out.println("Grade: " + grade);
}
}