Q:

Branching Statement : Nested if statement using C# Language

0

This Program is used to calculate the largest three numbers using nested if statement using C# Language

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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");      }   

           }

     }

  }

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now