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

Write C# program to find maximum number using switch case

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)
    {
 
        int num1=0, num2=0;
 
        //Reading two numbers from user
        Console.WriteLine("Enter two numbers to find maximum number: ");
        num1 = Convert.ToInt32(Console.ReadLine());
        num2 = Convert.ToInt32(Console.ReadLine());        
 
        // Condition to check maximum number
 
        switch (num1 > num2)
        {
            case true: Console.WriteLine(num1 + " is Maximum number");            
            break;
 
            case false: Console.WriteLine(num2+" is Maximum number");
            break;
 
        }
 
        Console.ReadLine();
 
    }
 
}

Result

Write C# program to find maximum number using switch case
Write C# program to find maximum number using switch case

Add a Comment

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