Pages

Monday, January 2, 2012

C Programming to read four numbers and display greatest one


/*to read 4 numbers and display greatest one*/
#include<stdio.h>
#include<stdlib.h>
int main( )
{
    float a,b,c,d;
    printf ("enter the numbers: ");
    scanf ("%f%f%f%f",&a,&b,&c,&d);
    if (a>b&&a>c&&a>d)
        printf ("%f is greatest",a);
    else if (b>c&&b>d)
        printf ("%f is greatest",b);
    else if (c>d)
        printf ("%f is greatest",c);
    else
        printf ("%f is greatest",d);
    system ("pause");
    return 0;
}

No comments:

Post a Comment