Q:

Branching Statement : switch Statement using C# Language

0

This Program is used to select the particular statement in the group of statement using switch C# Language

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;



public class examif

{

  public static void Main()

   {

      int a;

      Console.WriteLine("\n");

      Console.Write("enter the Grade(1,2,3,4,5) : ");

      a = Convert.ToInt32(Console.ReadLine());



      switch(a)

       {

            case 1 :

               Console.WriteLine("\nExcellent!");

               break;

            case 2 :

            case 3 :

               Console.WriteLine("\nWell done");

               break;

            case 4 :

               Console.WriteLine("\nYou passed");

               break;

            case 5 :

               Console.WriteLine("\nBetter try again");

               break;

            default:

               Console.WriteLine("\nInvalid grade");

               break;

       }

    }

 }

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now