Skip to content

Instantly share code, notes, and snippets.

@dejibimbolaAyo
Created May 25, 2016 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dejibimbolaAyo/14d33b8493618e80e86d696e48f0043e to your computer and use it in GitHub Desktop.
Save dejibimbolaAyo/14d33b8493618e80e86d696e48f0043e to your computer and use it in GitHub Desktop.
tests score and grades score
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace test_fail_with_grades
{
class Program
{
static void Main(string[] args)
{
int score = 0;
int accumulate = 0;
for (int n = 0; n < 10; n++)
{
accumulate = Convert.ToInt32(Console.ReadLine());
if (accumulate > 10)
{ Console.WriteLine("please enter a valid score not above 10");
n--; }
else
score = score + accumulate;
}
if (score <= 100 && score >= 70)
{
Console.WriteLine("distinction");
Console.WriteLine("A {0}", score);
}
else if (score <= 69 && score >= 55)
{
Console.WriteLine("credit");
Console.WriteLine("C {0}", score);
}
else if (score <= 54 && score >= 40)
{
Console.WriteLine("pass");
Console.WriteLine("P {0}", score);
}
else if (score <= 39 && score >= 0)
{
Console.WriteLine("failed");
Console.WriteLine("F {0}", score);
}
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment