In this example created the program that creates and save new data of student and its grades of their semester and school year.
This is a simple grading system program that was created in C# Console Application.
C# Grading System Code example Output:
C# Console Code: ( student marks calculation program in c# )
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 32 33 34 35 36 37 38 39 |
class Program { static void Main(string[] args) { int num1, num2, num3, avg=0; string grade; Console.WriteLine("---Student Marks Calculation Program in C#---\n"); Console.Write("Enter #1 Grade: "); num1 = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter #2 Grade: "); num2 = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter #3 Grade: "); num3 = Convert.ToInt32(Console.ReadLine()); if (num1 > 100 || num2 > 100 || num3 > 100) grade = "Error"; else if(num1 < 0 || num2 < 0 || num3 < 0) grade = "Error"; else { avg = (num1 + num2 + num3) / 3; if (avg > 100) grade = "Error"; else if (avg < 0) grade = "Error"; else if (avg > 90) grade = "A+"; else if (avg > 70) grade = "B+"; else if (avg > 50) grade = "C+"; else if (avg > 30) grade = "C"; else grade = "F"; } System.Console.Write("{0}\t{1}\t\n", avg, grade); Console.ReadLine(); } } |