Facebook
From Unreliable Prairie Dog, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 224
  1. #if(p1)
  2. int main(void)
  3. {
  4.         int n;
  5.         int potega=1;
  6.         int f1 = 1;
  7.         int f2 = 1;
  8.         int ciag= f1+f2;
  9.        
  10.         do
  11.                 {
  12.                         cout << ("Wprowadz liczbe nieujemna: "); cin >> n;
  13.                 } while (n <= 0);
  14.  
  15.                 for (int i = 1; i <= n; i++)
  16.                 {
  17.                         potega = potega*i;
  18.                 }
  19.                 cout << n << "!= " << potega << endl;
  20.  
  21.                 for (int i = 3; i <= n; i++)
  22.                 {
  23.                         ciag = f1 + f2;
  24.                         f2 = f1;
  25.                         f1 = ciag;
  26.                 }
  27.                 cout << "F(" << n << ") = " << ciag << endl;
  28.  
  29. }
  30. #endif //(p1)