To write a C# program to grade the marks.
Start the C# program in Visual studio 2022.
Create a class and declare one variable with integer datatype.
Get marks from the User.
Use if and elif condition to check the grade.
print the grade for the given mark.
Save the program and Run the program.
Take the screenshot of the output of the program.
using System;
namespace hello
{
class program
{
static void Main(string[] args)
{
int marks;
Console.WriteLine("ENTER THE MARK:");
marks = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("\nYOUR GRADE IS:");
if (marks>90)
Console.WriteLine("O GRADE");
else if (marks > 80)
Console.WriteLine("A+ GRADE");
else if (marks > 70)
Console.WriteLine("A GRADE");
else if (marks > 60)
Console.WriteLine("B+ GRADE");
else if (marks > 50)
Console.WriteLine("B GRADE");
else if (marks >= 40)
Console.WriteLine("C GRADE");
else
Console.WriteLine("FAIL");
}
}
}
Thus the C# program to grade the marks is executed successfully.