Answer to Question #288313 in C# for Gab

Question #288313

Create a program that will provide the information and discussion of the conditional

statements available in C# Programming Language.

Sample output:

Conditional Statements Menu

a. if ( )

b. if ( ) - else

c. nested if ( )

d. sequences of if ( ) - else - if ( ) - else - ...

e. switch ( ) – case

please select your choice: a

Conditional Statement “if”

The main format of the conditional statements if is as follows:

if (Boolean expression)

{

Body of the conditional statement;

}

It includes: if-clause, Boolean expression and body of the conditional

statement.

The Boolean expression can be a Boolean variable or Boolean logical

expression. Boolean expressions cannot be integer (unlike other

programming languages like C and C++).



1
Expert's answer
2022-01-17T16:12:08-0500
using System;

namespace if_else
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Conditional Statements Menu");
            Console.WriteLine("[a] if( )");
            Console.WriteLine("[b] if( )-else");
            Console.WriteLine("[c] nested if( )");
            Console.WriteLine("[d] sequences of if( ) - else - if( ) - else");
            Console.WriteLine("[e] switch( ) - case");
            Console.Write("\n Please select your choice: ");
            string str = Console.ReadLine();
            Console.Write($"You are selected [{str}]");
            Console.ReadLine();
          
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS