• Language

    C

  • Description

    It gets the average of three numbers.

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

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