Basic Programs

If Else based Programs

Loop Based Programs

Array Based Programs

String Programs

Function Programs

Pointers Programs

Structure & File Handling Programs

Data Structure Programs

If Else based Programs

C Program to find largest middle and smallest among three nos

#include <stdio.h>
#include <conio.h>
void main()
{
    int a=0,b=0,c=0,max=0,smax=0,tmax=0;
    printf("enter three nos");
    scanf("%d%d%d", &a,&b,&c);
    if(a>=b && a>=c)
     {
      max=a;
       if(b>c)
       {
        smax=b;
        tmax=c;
       }
      else
      {
       smax=c;
       tmax=b;
      }
    }
   if(b>=a && b>=c)
     {
       max=b;
       if(a>c)
       {
        smax=a;
        tmax=c;
      }
      else
      {
       smax=c;
       tmax=a;
      }
    }
   if(c>=b && c>=a)
     {
      max=c;
       if(a>b)
       {
        smax=a;
        tmax=b;
      }
      else
      {
       smax=b;
       tmax=a;
      }
    }
  printf("largest no=%d middle number=%d, smallest number=%d",max,smax,tmax);
}

Output of the above program is as following.

Video/ C Introduction

Watch video in full size
Wordpress Social Share Plugin powered by Ultimatelysocial