Problem: Excellent Grade or Not

The next exercise from this topic is to write a console program that inputs the grade (decimal number) and prints Excellent! if the grade is 5.50 or higher, otherwise "Not excellent.".

Sample Input and Output

Input Output
6 Excellent!
5 Not excellent.
5.5 Excellent!
5.49 Not excellent.

Creating a New C# Project and Writing the Program Code

First, we create a new C# console project in the Simple-Conditions solution.

  • We click on the solution in Solution Explorer and choose [Add] -> [New Project].

  • We choose [Visual C#] -> [Windows] -> [Console Application] and specify a name, for example: “Excellent-or-Not”.

Now we have to write the code of the program. You can get help by using the sample code from the picture:

Automatic Switching to the Current Project

We turn on the mode for automatic switching to the current project by right-clicking on the main Solution and choosing [Set StartUp Projects...]:

A dialog box will appear, and you have to choose [Startup Project] -> [Current selection]:

Local Testing

Now we run the program as usual with [Ctrl + F5] and test if it works correctly:

Testing in the Judge System

Test your solution here:

results matching ""

    No results matching ""