Student Mark Sheet In C#

Hello Guys! Welcome To My Blog!

Student Mark Sheet In C#

Today we will be learn how to make student Marksheet in C#

In this example !
The if-else ladder takes decision based on the value of percentage of marks
calculated and display the appropriate decision...


Program How To Make Student MarkSheet

using System;

namespace StundentProgress
{
    class Program
    {
        static void Main(string[] args)
        {
            string name;
            int percentage, total, computer, english, urdu, physics, islamiyat;
            int marks = 500;
            bool hello = true;
            while (hello)//this while loop is used for take input from user again and again
            {
                Console.WriteLine("Enter Student Name If you want Skip Program Type NO");
                name = Console.ReadLine();//this string variable is use for take user name
                if (name == "NO")//if user type NO the program will be break
                {
                    break;
                }

                Console.WriteLine("Enter Computer Marks");
                while (true)
                {
                    computer = int.Parse(Console.ReadLine());//First subject marks


                    if (computer > 100)//if user put greater then 100 number it show please enter a number from 1-100
                    {

                        Console.WriteLine("please enter a number from 1-100");
                    }
                    else { break; }
                }
                Console.WriteLine("Enter English Marks");//Second subject marks
                while (true)
                {
                    english = int.Parse(Console.ReadLine());


                    if (english > 100)
                    {

                        Console.WriteLine("please enter a number from 1-100");
                    }
                    else { break; }
                }
                Console.WriteLine("Enter Urdu Marks");//Third subject marks
                while (true)
                {
                   urdu = int.Parse(Console.ReadLine());


                    if (urdu > 100)
                    {

                        Console.WriteLine("please enter a number from 1-100");
                    }
                    else { break; }
                }
                Console.WriteLine("Enter Physics Marks");//Fourth subject marks
         
                while (true)
                {
                    physics = int.Parse(Console.ReadLine());


                    if (physics > 100)
                    {

                        Console.WriteLine("please enter a number from 1-100");
                    }
                    else { break; }
                }
                Console.WriteLine("Enter Islamiyat Marks");//Fifth subject marks

                while (true)
                {
                  islamiyat= int.Parse(Console.ReadLine());


                    if (islamiyat > 100)
                    {

                        Console.WriteLine("please enter a number from 1-100");
                    }
                    else { break; }
                }
                total = computer + english + urdu + physics + islamiyat;
                percentage = total * 100 / marks;//This is Percentage formula
             
               if (percentage >= 80)//if percentage greater than or equal  to 80 its print A1 Grade

                {
                    Console.WriteLine("_____STUDENT RESULT INFORMATION_____");
                    Console.WriteLine("\nName Of Student :  " + name + " \nGrade: A1 Grade " + " \nYour Percentage is " + percentage + "%" + " \nYour Obtain marks  " + total + " \nTotal Marks  " + marks);
                    Console.WriteLine("Congratulation!!!  " + name );

                }
                else if (percentage >= 70)//if percentage greater than  or equal  to  70 its print A Grade

                {
                    Console.WriteLine("_____STUDENT RESULT INFORMATION_____");
                    Console.WriteLine("\nStudent Name:  " + name + " \nYou got A Grade " + " \nPercentage:  " + percentage + "%" + " \nObtain marks:  " + total + " \nTotal Marks:  " + marks);
                    Console.WriteLine("Welldone  " + name );
                }
                else if (percentage >= 60)//if percentage greater than  or equal to  60 its print B Grade
                {
                    Console.WriteLine("_____STUDENT RESULT INFORMATION_____");
                    Console.WriteLine("\nStudent Name:  " + name + " \nYou got B Grade " + " \nPercentage:  " + percentage + "%" + " \nObtain marks:  " + total + " \nTotal Marks:  " + marks);
                    Console.WriteLine("Good  " + name );
                }
                else if (percentage >= 50)//if percentage greater than or equal to 50  its print C Grade
                {
                    Console.WriteLine("_____STUDENT RESULT INFORMATION_____");
                    Console.WriteLine("\nStudent Name:  " + name + " \nYou got C Grade " + " \nPercentage:  " + percentage + "%" + " \nObtain marks:  " + total + " \nTotal Marks:  " + marks);
                    Console.WriteLine("You Are Satisfactory Student  " + name );
                }
                else if (percentage >= 40)//if percentage greater than or equal to 50  its print C Grade
                {
                    Console.WriteLine("_____STUDENT RESULT INFORMATION_____");
                    Console.WriteLine("\nStudent Name:  " + name + " \nYou got D Grade " + " \nPercentage:  " + percentage + "%" + " \nObtain marks:  " + total + " \nTotal Marks:  " + marks);
                    Console.WriteLine("Fair You have to need Hard Work More..  " + name );
                }
                else//otherwise student is fail
                {
                    Console.WriteLine("_____STUDENT RESULT INFORMATION_____");
                    Console.WriteLine( "\nStudent Name:  " + name + " \nYou got F Grade " + " \nPercentage:  " + percentage + "%" + " \nObtain marks:  " + total + " \nTotal Marks:  " + marks);
                    Console.WriteLine("Fail You have to Give  the paper Again  " + name );

                }

            }
        }
    }
}

OUTPUT!

  1. The First Marksheet Is Of A1 grade
  2. And The Second Marksheet Is Of Fail

Comments