生成学生成绩单的 C# 程序
给定学生的分数,现在我们通过输入学生姓名和卷号计算学生的三个科目分数来生成学生的分数表。
例子:
Input:
Enter Student Roll-Number: 1
Enter Student Name: manoj
Enter Subject-1 Marks :90
Enter Subject-2 Marks :78
Enter Subject-3 Marks :96
Output:
Total Marks: 264
Percentage: 88
Grade is A
方法
- Declare the variables(i.e., marks1, marks2, and marks3) that will holds the marks of three subjects, i.e., Subject-1, Subject-2, and Subject-3.
- Read the student data from the user.
- Calculate total marks of the three subjects.
- Find the percentage.
- Display the final percentage of the student.
- Calculate and display the grades of the student also according to their percentage.
例子:
C#
total = marks1 + marks2 + marks3;
输出:
percentage = total / 3.0f;