• Lenguaje

    C++

  • Descripción

    Calcular la potencia de un número.

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

int main (void)
{
    float base, exponente, potencia;
    cout << "Ingresa el valor de base: ";
    cin >> base;
    cin.get();
    cout << "Ingresa el valor de exponente: ";
    cin >> exponente;
    cin.get();
    potencia=pow(base,exponente);
    cout << "Valor de potencia: " << potencia << endl;
    cout << endl;
    system ("pause");
    return EXIT_SUCCESS;
}