Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- float poisson(int x, int y)
- {
- if (y == 0)
- return pow(2.718281828, (-x));
- else
- {
- return ((float)x / y) * poisson(x, y - 1);
- }
- }
- int main()
- {
- int x, y;
- cout << "Enter the value of x and lambda reopectively: \n";
- cin >> x >> y;
- float ans = poisson(x, y);
- cout << "The result is: \n"
- << ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement