Tech Study

How To Find Largest Of Three Number In C# Program

Introduction

Write C# Program to Find the Largest Number Among Three Number. I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability..

using System;
 
namespace csharpprograms
{
    class Program
    {
        static void Main(string[] args)
        {
            int num1, num2, num3;          
 
            Console.Write("Input the 1st number :");
            num1 = Convert.ToInt32(Console.ReadLine());
            Console.Write("Input the  2nd number :");
            num2 = Convert.ToInt32(Console.ReadLine());
            Console.Write("Input the 3rd  number :");
            num3 = Convert.ToInt32(Console.ReadLine());
 
            if (num1 > num2)
            {
                if (num1 > num3)
                {
                    Console.Write("The 1st Number is the greatest among three. \n\n");
                }
                else
                {
                    Console.Write("The 3rd Number is the greatest among three. \n\n");
                }
            }
            else if (num2 > num3)
                Console.Write("The 2nd Number is the greatest among three \n\n");
            else
                Console.Write("The 3rd Number is the greatest among three \n\n");
 
            Console.ReadLine();
 
        }
    }
}

Result

Write C# Program to Find the Largest Number Among Three Number
Write C# Program to Find the Largest Number Among Three Number

Write C# Program to Find the Largest Number using Conditional Operator

Write C# program to print alphabets from a to z

TaggedWrite C# Program to Find the Largest Number Among Three Number

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more