C#

Branching Statement : Nested if statement

Branching Statement : Nested if statement
using System;

public class exam

 {

    public static void Main()

     {

        int x,y,z;



        Console.WriteLine("\n");

        Console.Write("Enter the 1st value : ");

        x=int.Parse(Console.ReadLine());



        Console.WriteLine("\n");

        Console.Write("Enter the 2nd value : ");

        y=int.Parse(Console.ReadLine());

        Console.WriteLine("\n");

        Console.Write("Enter the 3rd value : ");

        z=int.Parse(Console.ReadLine());

        if(x>=y)

         {

            if(x>=z)

              {     Console.WriteLine("\nx is greater value");       }

                 else

                    {   Console.WriteLine("\nz is greater value");    }

               }

          else

             {

               if(y>=z)

                 {     Console.WriteLine("\ny is greater value");      }

                else

                  {     Console.WriteLine("\nz is greater value");      }   

           }

     }

  }
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.