{ A destination to learn coding }

Finding greatest in three numbers
using if/else statement


#include < stdio.h >
int main()
{
    int a,b,c;
    printf("Enter any 3 numbers\n");
    scanf("%d%d%d",&a,&b,&c);

    if(a > b)
    {
        if(a > c)
        {
            printf("%d is greater\n",a);
        }

        else
        {
            printf("%d is greater\n",c);
        }
    }

    else

    {
        if(b > c)
        {
            printf("%d is greater\n",b);
        }

        else
        {
            printf("%d is greater\n",c);
        }
    }

    return 0;

}

Finding greatest in three numbers
using and AND logical operator


#include < stdio.h >
int main()
{
    int a,b,c;
    printf("Enter any 3 numbers\n");
    scanf("%d%d%d",&a,&b,&c);

    if(a>b&&a>c)
        printf("%d is greater\n",a);

    else if(b>c)
        printf("%d is greater\n",b);

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

    return 0;
}