Saturday, October 31, 2020

C program to find the smallest, middle and greatest number amongst the three given number

 #include <stdio.h>

int main()

{

    int a,b,c;

    printf("Enter a,b,c:");

    scanf("%d %d %d",&a,&b,&c);

    if(a>b)

    {

        if(a<c)

        {

            printf("%d is greatest\n",c);

            printf("%d is middle\n",a);

            printf("%d is smallest\n",b);

        }

        else if(b>c)

        {

            printf("%d is greatest\n",a);

            printf("%d is middle\n",b);

            printf("%d is smallest\n",c);

        }

        else

        {

            printf("%d is greatest\n",b);

            printf("%d is middle\n",c);

            printf("%d is smallest\n",a);

        }

    }

    else if(b<c)

    {

        printf("%d is greatest\n",c);

        printf("%d is middle\n",b);

        printf("%d is smallest\n",a);

    }

    else if(a>c)

    {

        printf("%d is greatest\n",b);

        printf("%d is middle\n",a);

        printf("%d is smallest\n",c);

    }

    else

    {

        printf("%d is greatest\n",c);

        printf("%d is middle\n",b);

        printf("%d is smallest\n",a);

    }

    return 0;

}


No comments:

Post a Comment

SAP Tcodes

zme27 - Automatic STO creation mmbe - Stock Overview, Material, Batch me51n - Create Purchase Requisition me21n - Create Purchase Order me59...