1. Course
  2. Flow controls B
  3. Switch, break and default

Switch, break and default


Last updated: 8/22/2020 Difficulty: Easy

Create a C# program that calculates a student's grade from an integer. Ask the user for a number (x) and answer the following:

  • 10 - A+
  • 9 - A
  • 7,8 - B
  • 6 - C
  • 5 - E
  • 0,4 - F

Use the switch, break and default instruction of C#.

Input

10

Output

A+

Solution

Flow controls B

6 / 8

Android App


Practice C# anywhere with the free app for Android devices.

Android App

Exercises C# by difficulty


Learn C# at your own pace, the exercises are ordered by difficulty.

Advertising