/*
Name: yasmin Manrique Gomez
Copyright: switch y sentencia repetitiva for
Author:
Date: 01/10/17 00:17
Description: 2. Realizar un Programa que calcule la siguiente sumatoria: y= (1+1!) +(2+2!)+..+ (N+N), siendo N un numero entero
introducido por teclado y denotandose por x! es el factorial de x. Incluir mensaje Dato Incorrecto , cuano se digite numeros
menores o iguales a cero.
*/
#include <iostream>
#include <stdio.h>
using namespace std;
int main ()
{
int a,b,c=1,d,factorial,fact1=1,fact2=0,i,j,y,prod;
cout<<" \nEste programa calculara el factorial del numero entero que ingrese \nPor favor ingrese su numero "<<endl;
cin >> a;
factorial=1;
if(a<=0){
cout<<"ERROR DE CODIGO"<<endl;
}else{
for (b=1 ; b<=a ; b++)
{
for(d=2;d<=a;d+=2)
d++;
c++;
fact1=d+c;
factorial=b*factorial;
y=factorial+fact1;
}
cout<<endl<<"sumatoria del Factorial "<<"Y = (1+1!)+ (2+2!)+"<<"("<<a<<"+"<<a<<")"<<"!"<<"="<<y<<endl;
}
system("pause");
return 0;
}
Comentarios sobre la versión: 4.9 (0)
No hay comentarios