Advertisement
Guest User

Primele n ratii

a guest
Dec 5th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.     int n, a=0, b=1, c;
  7.     cout << "n = "; cin >> n;
  8.     for(int i=1; i<=n; i++){
  9.         c=a+b;
  10.         a=b;
  11.         b=c;
  12.         double ratie=(double)b/(double)a;
  13.         cout << "Ratie" << " " << i << ": " << ratie << endl;
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement