Saturday, October 31, 2020

C program to find the greatest number amongst the four given number

#include <stdio.h>

int main()

{

    int a,b,c,d;

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

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

    if(a>b)

    {

        if(a>c)

        {

            if(a>d)

            {

                printf("a");

            }

            else

            {

                printf("d");

            }

        }

        else if(c>d)

        {

            printf("c");

        }

        else

        {

            printf("d");

        }

    }

    else if(b>c)

    {

        if(b>d)

        {

            printf("b");

        }

        else

        {

            printf("d");

        }

    }

    else if(d>c)

    {

        printf("d");

    }

    else

    {

        printf("c");

    }

}

No comments:

Post a Comment

Can’t Read Books? Try This 5-Minute Habit Instead (It Actually Works)

Can’t Read Books? Try This 5-Minute Habit Instead (It Actually Works)   Hi, namaste Krishna. So, um today I'll be sharing a very good ha...