Untitled
unknown
plain_text
4 years ago
476 B
4
Indexable
//Calcular la siguiente serie: // S=x^1/1+〖x^2/2+x^3/3+ ......+x^n/3.〗 #include <iostream> #include <math.h> using namespace std; int main() { int cant = 0, n = 0; float x = 0, prod = 0, num = 0; cout << "Ingrese n: "; cin >> n; cout << "Ingrese x: "; cin >> x; while (cant < n) { cant = cant + 1; prod = prod + (pow(x, cant) / cant); } cout << "La Suma es: " << prod << endl; return 0; }
Editor is loading...