Write a C# program to check whether a given substring is present in the given string

Write C# program to print gender (Male/Female) program according to given M/F

Introduction

I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.

using System;
 
class Program
{
 
    static void Main(string[] args)
    {
 
        char gender;
 
        //Reading gender from user
        Console.WriteLine("Enter gender (M/m or F/f): ");
        gender = Convert.ToChar(Console.ReadLine());
 
 
    // checking vowel and consonant
        switch (gender)
        {
            case 'M':
            case 'm': Console.WriteLine("MALE");
            break;
 
            case 'F':
            case 'f': Console.WriteLine("FEMALE");
            break;
 
            default: Console.WriteLine("Unspecified Gender");
                break;
        }
 
        Console.ReadLine();
 
    }
 
}

Result

Write C# program to print gender (Male/Female) program according to given M/F
Write C# program to print gender (Male/Female) program according to given M/F

Add a Comment

Your email address will not be published. Required fields are marked *