-->

Facebook

Jasper Roberts - Blog

Thursday, September 18, 2014

Write a C Program to select & print the largest of the three nos. using Nested-If-Else statement.

#include<stdio.h>
#include<conio.h>

void main()
{
      int a,b,c;
      clrscr();

      printf("Enter the values of a: ");
      scanf("%d",&a);

      printf("Enter the values of b: ");
      scanf("%d",&b);

      printf("Enter the values of c: ");
      scanf("%d",&c);



     if(a>b)
    {
             if(a>c)
             {
                       printf(" a is largest number.");
             }
             else
            {
                        printf(" c is largest number.");
            }
     }
    
    else
    {
            if(b>c)
           {
                       printf(" b is largest number.");
           }
           else
          {
                      printf(" c is largest number.");
          }
    }

getch();

}



OUTPUT:

largest.c

No comments:

Post a Comment