Search This Blog

Loading...

C program to find maximum and minimum number

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

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

    printf("Enater a:");
    scanf("%d",&a);

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

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

    if(a>b && a>c)
    {
        printf("maximum number is a=%d",a);
    }
    else if(b>a && b>c)
    {
        printf("maximum number is b=%d",b);
    }

    else
    {
        printf("maximum number is c=%d",c);
    }



    if(a<b && a<c)
    {
        printf("minimum munber is a=%d",a);
    }
    else if(b<a && b<c)
    {
        printf("minimum number is b=%d",b);
    }
    else
    {
        printf("minimum number is c=%d",c);
    }


    getch();
}


Output:
Enter a: 5
Enter b: 3
Enter c: 6
maximum number c=6
minimum number b=3