Computer Science, asked by Prisilla, 7 months ago

Write a program to accept a mark obtained by a student in computer science and print the grades accordingly:

        Marks                                Grade

        Above 90                      A

        71to 90                      B

        50 to 70                      C

        Below 50        ​

Answers

Answered by anindyaadhikari13
12

\star\:\:\:\sf\large\underline\blue{Question:-}

  • Write a program to accept a mark obtained by a student in computer science and prints thr grades accordingly.

\star\:\:\:\sf\large\underline\blue{Source\:Code:-}

Here is the code written in Java.

import java.util.*;

class Grade

{

public static void main(String str[])

{

Scanner sc=new Scanner(System.in);

System.out.print("Enter the marks: ");

int n=sc.nextInt();

String grade="";

if(n>=90&&n<=100)

grade="A";

else if(n>=71)

grade="B";

else if(n>=50)

grade="C";

else if(n>=0)

grade="Fail";

System.out.println("Grade: "+grade);

}

}

Similar questions