The first exercise for 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.
Input | Output |
---|---|
6 | Excellent! |
5 | (no output) |
5.5 | Excellent! |
5.49 | (no output) |
We create a new project in the existing Visual Studio solution. In Solution Explorer, right-click on Solution 'Simple-Conditions'. Then choose [Add] -> [New Project]:
A dialog box will open for selecting a project. Choose C# console application and specify a name, for example "Excellent-Result":
Now we have a solution with one console application in it. What remains is to write the code to solve the problem.
For this purpose, we go into the body of the Main (string [] args)
method and write the following code:
Run the program with [Ctrl+F5], to test it with different input values:
Test your solution from the example here: https://judge.softuni.org/Contests/Practice/Index/506#0.