• Language

    C

  • Description

    It accepts three numbers from a user and displays a message if the sum of any two numbers equals the third.

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

int main (void)
{
    float a, 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 ();
    if(a+b==c||b+c==a||c+a==b)
        printf ("The sum of any two numbers equals the third.\n");
    else
        printf ("The sum of any two numbers not equals the third.\n");
    putchar ('\n');
    system ("pause");
    return EXIT_SUCCESS;
}