Computer Science, asked by soniakaur1978, 2 months ago

Plz tell the answers quickly
I will mark the correct ans
Brainest plz plz

Attachments:

Answers

Answered by anindyaadhikari13
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:

  1. START
  2. Accept the marks percentage.
  3. Calculate the grade on the basis of the condition given.
  4. Display the result.
  5. STOP

Refer to the attachment for output ☑.

Attachments:
Similar questions