Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

to find greatest of 4 numbers in c

#include <stdio.h>

int main()
{
    int a, b, c, d;
    printf("enter four numbers:");
    scanf("%d %d %d %d", &a, &b, &c, &d);
    if (a > b)
    {
        if (a > c)
        {
            if (a > d)
            {
                printf("%d is greatest 
", a);
            }
        }
    }
    else
    {
        if (b > c)
        {
            if (b > d)
            {
                printf("%d is greatest 
", b);
            }
        }
        else
        {
            if (c > d)
            {
                printf("%d is greatest 
", c);
            }
            else
            {
                printf("%d is greatest 
", d);
            }
        }
    }

    return 0;
}
 
PREVIOUS NEXT
Tagged: #find #greatest #numbers
ADD COMMENT
Topic
Name
2+8 =