#include "iostream"
#include "stdlib.h"
using namespace std;
int main(){
int N;
float result = 1, factorial = 1;
cout << "Enter integer more than 0: "; cin >> N;
if(N > 0){
for (int i = 1; i < N+1; i++){
factorial = factorial * i;
result = result + 1/(factorial);
cout << result << endl;
}
cout << "Result: " << result << endl;
}else cout << "You entered integer less than 0" << endl;
system("pause");
return 0;
#include "iostream"
#include "stdlib.h"
using namespace std;
int main(){
int N;
float result = 1, factorial = 1;
cout << "Enter integer more than 0: "; cin >> N;
if(N > 0){
for (int i = 1; i < N+1; i++){
factorial = factorial * i;
result = result + 1/(factorial);
cout << result << endl;
}
cout << "Result: " << result << endl;
}else cout << "You entered integer less than 0" << endl;
system("pause");
return 0;
}