Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     float a;
  8.     int n;
  9.     float p;
  10.  
  11.     cout << "Enter a: ";
  12.     cin >> a;
  13.     cout << "Enter n: ";
  14.     cin >> n;
  15.  
  16.     p = a;
  17.  
  18.     for (int i = 1; i < n; i++)
  19.     {
  20.         p *= (a + i);
  21.     }
  22.  
  23.     cout << "P: " << p;
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement