Write a program to find the maximum/minimum number from given three numbers.



#include <stdio.h>
void main ()
{
      int a,b,c ;
      printf("enter number= ");
      scanf("%d%d%d", &a,&b,&c);
      if(a>=b && b>=c)
            printf("max:%d\nmin:%d\n",a,c);
      else if(c>=b && b>=a)
            printf("max:%d\nmin:%d\n",c,a);
    else if(b>=a && a>=c)
            printf("max:%d\nmin:%d\n",b,c);
      else if(c>=a && a>=b)
        printf("max:%d\nmin:%d\n",c,b);
      else if(a>=c && c>=b)
          printf("max:%d\nmin:%d\n",a,b);
      else if(b>=c && c>=a)
            printf("max:%d\nmin:%d\n",b,a);
     
}

Comments