Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ofstream fout("bac.txt");
- int main() {
- int a, b, c = 0;
- cin >> a >> b;
- fout << b << ' ' << a << ' ';
- while (c != 1) {
- c = 3 * a - b;
- fout << c << ' ';
- b = a;
- a = c;
- }
- fout << 1 << ' ';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement