How to calculate result of subjects in C#.png
Object
Code
Screen Shot
Object
Write a program that reads out marks sheet of a student.
Take the marks of five subjects as input from the user and calculate the total
marks, percentage and grade. Display the entire information on the console
based on the following grade criteria.
Total
Marks
|
Grade
|
Greater
than or equal to 90 but less than 100
|
A
|
Less
than 90 but greater than or equal to 80
|
B
|
Less
than 80 but greater than or equal to 70
|
C
|
Less
than 70 but greater than or equal to 60
|
D
|
Less
than 60
|
F
|
Code
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace MarkSheet
{
class
Program
{
static void Main(string[] args)
{
int urdu, math, islamiate, computer, english;
Console.WriteLine("\t\t!*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$!");
Console.WriteLine("\t\t!*********MARK
SHEET*************!");
Console.WriteLine("\t\t!*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$!\n");
Console.WriteLine("\t\tENTER
THE MARKS\n");
Console.WriteLine("English");
english=int.Parse(Console.ReadLine());
Console.WriteLine("Urdu");
urdu = int.Parse(Console.ReadLine());
Console.WriteLine("Math");
math = int.Parse(Console.ReadLine());
Console.WriteLine("Islamiate");
islamiate = int.Parse(Console.ReadLine());
Console.WriteLine("Computer");
computer = int.Parse(Console.ReadLine());
int totalMarks=math+urdu+islamiate+english+computer;
Console.WriteLine("Total
Marks : " +totalMarks);
double per= (totalMarks * 100 / 500);
Console.WriteLine("Percentage
% :" +per);
if(per>=90 &&per<=100)
{
Console.WriteLine("Grade
is : \"A\"");
}
else if (per >= 80
&& per < 90)
{
Console.WriteLine("Grade
is : \"B\"");
}
else if (per >= 70
&& per <80)
{
Console.WriteLine("Grade
is : \"C\"");
}
else if (per >= 60
&& per < 70)
{
Console.WriteLine("Grade
is : \"D\"");
}
else
{
Console.WriteLine("Grade
is : \"F\"");
}
}
Screen Shot
Wonderful.
ReplyDeleteNice Work!!! Keep it up
ReplyDelete