Untitled

 avatar
unknown
plain_text
4 years ago
442 B
5
Indexable
//7.	Calcular la siguiente serie, donde X es un número real.
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
    int cant = 0, N = 0;
    float x = 0, prod = 0;
    cout << "Ingrese N: ";
    cin >> N;
    cout << "Ingrese x: ";
    cin >> x;
    while (cant < N)
    {
        cant = cant + 1;
        prod = prod + pow(x, cant);
    }
    cout << "La Suma es: " << prod << endl;
    return 0;
}
Editor is loading...