# C# Program to Calculate Percentage,Division Reading roll no,name & marks

The Program in C# Program to Calculate Percentage,Division Reading roll no,name & marks is given below:

``````using System;

namespace StudentResult
{
class Program
{
static void Main(string[] args)
{
int rollNo;
string name;
float subject1, subject2, subject3, total, percentage;
string division;

Console.WriteLine("Hello Codeauri Family,enter the roll number here:");

Console.WriteLine("Enter the name:");

Console.WriteLine("Enter the marks of three subjects:");

// Calculate the total marks
total = subject1 + subject2 + subject3;

// Calculate the percentage
percentage = (total / 300) * 100;

// Check the division
if (percentage >= 60)
{
division = "First";
}
else if (percentage >= 50)
{
division = "Second";
}
else if (percentage >= 40)
{
division = "Third";
}
else
{
division = "Fail";
}

Console.WriteLine("Roll No: " + rollNo);
Console.WriteLine("Name: " + name);
Console.WriteLine("Total Marks: " + total);
Console.WriteLine("Percentage: " + percentage + "%");
Console.WriteLine("Division: " + division);
}
}
}
``````

## Output:

Hello Codeauri Family,enter the roll number here:
7
Enter the name:
Joseph
Enter the marks of three subjects:
89
90
98
Roll No: 7
Name: Joseph
Total Marks: 277
Percentage: 92.33334%
Division: First

## Pro-Tips💡

Here are the step by step execution of above program:

1. A namespace named “StudentResult” is declared which contains the code for the program.
2. In the namespace, there is a class named “Program” which has a Main method as the entry point of the program.
3. Inside the Main method, various variables are declared to store the roll number, name, marks of three subjects, total marks, percentage, and division of the student.
4. The program then takes input from the user for the roll number, name, and marks of three subjects using the Console.ReadLine method.
5. The total marks are calculated by adding up the marks of three subjects.
6. The percentage is calculated by dividing the total marks by 300 and multiplying by 100.
7. An if-else statement is used to determine the division of the student based on their percentage.
8. The result of the student is then displayed on the console using Console.WriteLine method, including the roll number, name, total marks, percentage, and division.
9. The program ends when all the statements in the Main method are executed.

### Learn C-Sharp ↗

C-sharp covers every topic to learn about C-Sharp thoroughly.

### Learn C Programming ↗

C-Programming covers every topic to learn about C-Sharp thoroughly.

### Learn C++ Programming↗

C++ covers every topic to learn about C-Sharp thoroughly.

Codeauri is Code Learning Hub and Community for every Coder to learn Coding by navigating Structurally from Basic Programming to Front-End Development, Back-End Development to Database, and many more.

## Programming Languages( Types, Pros and Cons)-Codeauri

What are the types or levels of Programming Languages? The types or levels of programming languages are divided into two types: Types Of Programming Languages: 1.Machine-level Language :1st…

## C# Program to Find Sum of Rows & Columns of a Matrix

The Program in C# Program to Find Sum of Rows & Columns of a Matrix is given below: Output: Hello Codeauri Family,enter the number of rows and columns…

## C# Program to Calculate Determinant of Given Matrix

The Program in C# Program to Calculate Determinant of Given Matrix is given below: Output: Hello Codeauri Family, enter the number of rows and columns of the matrix…

## C# Program to Find Sum of right Diagonals of a Matrix

The Program in C# Program to Find Sum of right Diagonals of a Matrix is given below: Output: Hello Codeauri Family, enter the number of rows and columns…

## C# Program to Find Transpose of Given Matrix

The Program in C# Program to Find Transpose of Given Matrix is given below: Output: Hello Codeauri Family, enter the number of rows and columns in the matrix:22Enter…

## C# Program for Multiplication of two square Matrices

The Program in C# Program for Multiplication of two square Matrices is given below: Output: Hello Codeauri Family, enter the number of rows/columns in the matrices:2Enter the elements…

Your Journey into Code Begins Now: Discover the Wonders of Basic Programming

X