• Lenguaje

    C++

  • Descripción

    Lea 4 variables numéricas y calcule e imprima la suma, su media aritmética y producto.

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
#ifdef __MSDOS__
    #include <iostream.h>
    #include <stdlib.h>
#else
    #include <iostream>
    #include <cstdlib>
    using namespace std;
#endif

int main (void)
{
    float a, b, c, d, media;
    float producto, suma;
    cout << "Ingresa el valor de a: ";
    cin >> a;
    cin.get();
    cout << "Ingresa el valor de b: ";
    cin >> b;
    cin.get();
    cout << "Ingresa el valor de c: ";
    cin >> c;
    cin.get();
    cout << "Ingresa el valor de d: ";
    cin >> d;
    cin.get();
    suma=a+b+c+d;
    media=suma/4;
    producto=a*b*c*d;
    cout << "Valor de media: " << media << endl;
    cout << "Valor de producto: " << producto << endl;
    cout << "Valor de suma: " << suma << endl;
    cout << endl;
    system ("pause");
    return EXIT_SUCCESS;
}