Answer to Question #44739 in C# for Esther

Question #44739
Using C# Console Application , How do you assign a symbol from A to F depending on their average
A>=80 & 100
B>=70 & 79
C>=60 & 69
D>=50 & 59
E>= 40& 49
F<40
1
Expert's answer
2014-08-07T04:10:26-0400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;
namespace Sharp_44739
{
class Program
{
static void Main(string[] args)
{
int digit;
char result;
do
{
Console.Clear();
Console.WriteLine("Please enter integer average mark:");
if (!Int32.TryParse(Console.ReadLine(), out digit) || digit < 0 || digit> 100)
{
Console.WriteLine("Wrong input!. Press any key to continue...");
Console.ReadKey();
continue;
}
if (digit >= 80) result = 'A';
else
if (digit >= 70) result = 'B';
else
if (digit >= 60) result = 'C';
else
if (digit >= 50) result = 'D';
else
if (digit >= 40) result = 'E';
else result = 'F';
Console.WriteLine("Assigned value is: {0}\nPress ESC to exit or anything to continue...", result);
} while (Console.ReadKey().Key != ConsoleKey.Escape);
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS