HOT C PROGRAMS BLOGSPOT

HOT C PROGRAMS BLOGSPOT

Click On Related Results For More Information

Wednesday 3 October 2012

Greatest Among Three Numbers Using If Else Loop

                     Greatest Among Three Numbers Using If Else Loop



/*Program to find greatest among three numbers*/
#include<stdio.h>
#include<conio.h>
void main()
{
 int a,b,c;
 clrscr();
 printf("    Enter three different digits\n");
 scanf("%d %d %d",&a,&b,&c);
 printf("    The input numbers are= ");
 printf("a=%d , b=%d , c=%d",a,b,c) ;
 printf("\n");
  if(a>b)
   {
        if(b>c)
          {
               printf("  Here a is greatest integer.\n");
               printf("  The value of a is= %d",a);
          }
       else
          {
                printf("  Here c is greatest integer\n");
                printf("  The value of c is= %d",c);
          }
   }
  else
    {
          if(b>c)
           {
               printf("  Here b is greatest integer\n");
               printf("  The value of b is= %d",b);
           }
        else
           {
               printf("  Here c is greatest integer\n");
               printf("  The value of a is= %d",c);
           }
     }
  getch();
 }

No comments:

Post a Comment