• Language

    C

  • Description

    Greatest of three numbers

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
#include <stdlib.h>

int main (void)
{
    float a, b, c, greatest;
    printf ("Enter the value of a: ");
    scanf ("%f", &a);
    (void) getchar ();
    printf ("Enter the value of b: ");
    scanf ("%f", &b);
    (void) getchar ();
    printf ("Enter the value of c: ");
    scanf ("%f", &c);
    (void) getchar ();
    greatest=a;
    if(greatest<b)
        greatest=b;
    if(greatest<c)
        greatest=c;
    printf ("Value of greatest: %g\n", greatest);
    putchar ('\n');
    system ("pause");
    return EXIT_SUCCESS;
}