Plz tell the answers quickly
I will mark the correct ans
Brainest plz plz
Attachments:
Answers
Answered by
1
Required Answer:-
Question:
- Write a program to display the grade of a student.
Solution:
Here comes the códe.
import java.util.*;
public class Grade {
public static void main(String[] args) {
double marks;
String g;
Scanner sc=new Scanner(System.in);
System.out.print("Enter marks percentage: ");
marks=sc.nextDouble();
if(marks>=90)
g="O";
else if(marks>=80)
g="A";
else if(marks>=70)
g="B";
else
g="C";
System.out.println("Grade: "+g);
sc.close();
}
}
Algorithm:
- START
- Accept the marks percentage.
- Calculate the grade on the basis of the condition given.
- Display the result.
- STOP
Refer to the attachment for output ☑.
Attachments:
Similar questions