C Program to Find largest, Smallest of 3 Numbers


Couch ModePrint

/*WAP to find largest, smallest of 3 numbers*/
#include<stdio.h>
void main()
{
   int a,b,c;
   clrscr();
   printf("Enter 3 Numbers-\n");
   scanf("%d%d%d",&a,&b,&c);
   if(a>b)
  {
     if(a>c)
       printf("%d Is Largest\n",a);
         else
       printf("%d Is Largest\n",c);
  }
     else
  {
     if(b>c)
       printf("%d Is Largest\n",b);
         else
       printf("%d Is Largest\n",c);
  }
   if(a<b)
  {
     if(a<c)
       printf("%d Is Smallest\n",a);
         else
       printf("%d Is Smallest\n",c);
  }
  else
  {
     if(b<c)
       printf("%d Is Smallest\n",b);
         else
       printf("%d Is Smallest\n",c);
  }
  getch();
}

OutPut:

Enter 3 Numbers-
6 78 982
982 Is Largest
6 Is Smallest

Thank Your Valuable Comment Tool to Insert codes in Comments : Convert My Code. Hide

Select to parse the code (not required if code is already parsed):

Subscribe By Email

Join Our Newsletter

Get All The Latest Updates Delivered Straight Into Your Inbox For Free!

We Respect Your Privacy

Popular Posts