Advertisement
STANAANDREY

bacT1 sIII 3

May 24th, 2021
975
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ofstream fout("bac.txt");
  5.  
  6. int main() {
  7.     int a, b, c = 0;
  8.     cin >> a >> b;
  9.     fout << b << ' ' << a << ' ';
  10.     while (c != 1) {
  11.         c = 3 * a - b;
  12.         fout << c << ' ';
  13.         b = a;
  14.         a = c;
  15.     }
  16.     fout << 1 << ' ';
  17.     return 0;
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement