• Language

    C

  • Description

    Ask for three numbers and get the bigger an the smaller.

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
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <stdlib.h>

int main (void)
{
    float a, b, bigger, c, smaller;
    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 ();
    if(a>b)
    {
        bigger=a;
        smaller=b;
    }
    else
    {
        bigger=b;
        smaller=a;
    }
    if(bigger<c)
        bigger=c;
    if(smaller>c)
        smaller=c;
    printf ("Value of bigger: %g\n", bigger);
    printf ("Value of smaller: %g\n", smaller);
    putchar ('\n');
    system ("pause");
    return EXIT_SUCCESS;
}