#include<iostream>
#include<string>
#include<cmath>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
string convertiratexto(float f);
int main() {
float fact;
float fact2;
int i;
float inv;
float j;
float k;
float num1;
float pot;
float pot2;
float suma;
float sumatoria;
string texto1;
string texto2;
string texto3;
string texto4;
string texto5;
string texto6;
string texto7;
string texto8;
string texto9;
float total1;
float total2;
float total3;
float total4;
float total5;
float total6;
float total7;
float total8;
float total9;
cout << "\nDigite un numero para calcular serie" << endl;
cin >> num1;
texto1 = "";
texto2 = "";
texto3 = "";
texto4 = "";
texto5 = "";
texto6 = "";
texto8 = "";
texto7 = "";
total1 = 0;
total2 = 0;
total3 = 0;
total4 = 0;
total5 = 0;
total6 = 0;
total7 = 0;
total8 = 0;
sumatoria = 0;
inv = num1;
for (i=1;i<=num1;i++) {
fact = 1;
suma = 0;
pot = 0;
if (i==num1) {
texto1 = texto1+(convertiratexto(i)+"^2");
texto2 = texto2+(convertiratexto(i)+"!");
texto3 = texto3+((convertiratexto(i)+"^")+convertiratexto(i));
texto6 = texto6+convertiratexto(i);
texto9 = texto9+((convertiratexto(i)+"^")+convertiratexto(inv));
} else {
texto1 = texto1+(convertiratexto(i)+"^2 +");
texto2 = texto2+(convertiratexto(i)+"! +");
texto3 = texto3+(convertiratexto(i)+"^"+convertiratexto(i)+" +");
texto6 = texto6+(convertiratexto(i)+" +");
texto9 = texto9+(convertiratexto(i)+"^"+convertiratexto(inv)+" +");
}
if (i%2==0 ){
texto4 = texto4+(" +"+convertiratexto(i)+"^"+convertiratexto(i));
} else {
texto4 = texto4+(" -"+convertiratexto(i)+"^"+convertiratexto(i));
}
texto5 = texto5+("("+convertiratexto(i)+"+(");
texto7 = texto7+"(";
texto8 = texto8+"(";
for (j=1;j<=i;j++) {
fact2 = 1;
for (k=1;k<=j;k++) {
fact2 = (fact2*k);
}
fact = (fact*j);
suma = (suma+j);
pot = pot+(pow(i,j));
pot2 = pot+(pow(i,fact2));
fact2 = 0;
if (j==i) {
if (i==num1) {
texto7 = texto7+convertiratexto(i)+"^"+convertiratexto(j)+") ";
texto8 = texto8+convertiratexto(i)+"^!"+convertiratexto(j)+") ";
} else {
texto7 = texto7+convertiratexto(i)+"^"+convertiratexto(j)+") + ";
texto8 = texto8+convertiratexto(i)+"^!"+convertiratexto(j)+") + ";
}
texto5 = texto5+convertiratexto(j)+")) + ";
} else {
texto7 = texto7+convertiratexto(i)+"^"+convertiratexto(j)+"+";
texto8 = texto8+convertiratexto(i)+"^!"+convertiratexto(j)+" +";
texto5 = texto5+convertiratexto(j)+"+";
}
}
total1 = total1+(i*i);
total2 = total2+fact;
total3 = total3+(pow(i,i));
total5 = total5+(i+suma);
total7 = total7+pot;
total8 = total8+pot2;
total9 = total9+(pow(i,inv));
if (i%2==0) {
total4 = total4+(pow(i,i));
} else {
total4 = total4-(pow(i,i));
}
sumatoria = sumatoria+i;
inv = (inv-1);
}
total6 = total2/sumatoria;
cout << "\nSERIE NUMERO 1" << endl;
cout << texto1 << " =" << total1 << endl;
cout << " " << endl;
cout << "\nSERIE NUMERO 2" << endl;
cout << texto2 << " =" << total2 << endl;
cout << " " << endl;
cout << "\nSERIE NUMERO 3" << endl;
cout << texto3 << " =" << total3 << endl;
cout << " " << endl;
cout << "\nSerie NUMERO 4" << endl;
cout << texto4 << " =" << total4 << endl;
cout << " " << endl;
cout << "\nSerie NUMERO 5" << endl;
cout << texto5 << " =" << total5 << endl;
cout << " " << endl;
cout << "\nSERIE NUMERO 6" << endl;
cout << "( " << texto2 << " )/(" << texto6 << " ) =" << total6 << endl;
cout << " " << endl;
cout << "\nSERIE NUMERO 7" << endl;
cout << texto7 << " =" << total7 << endl;
cout << " " << endl;
cout << "\nSERIE NUMERO 8" << endl;
cout << texto8 << " =" << total8 << endl;
cout << " " << endl;
cout << "\nSERIE NUMERO 9" << endl;
cout << texto9 << " =" << total9 << endl;
return 0;
}