Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<stdio.h>
- using namespace std;
- int main() {
- int b, factb= 1, factc = 1, sum = 0;
- cout << "b= "; cin >> b;
- for(int i = 1; i <= b; i++) factb *= i;
- for (int i = 1; i <= b; i++) {
- sum += factb / factc;
- factc *= i + 1;
- }
- cout << "Rezultatul este: " << (double)sum/factb<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement