Skip to content

Instantly share code, notes, and snippets.

@invatainfo
Created September 16, 2017 15:04
Show Gist options
  • Save invatainfo/e751576788314111a32f7a2dab0c2ae8 to your computer and use it in GitHub Desktop.
Save invatainfo/e751576788314111a32f7a2dab0c2ae8 to your computer and use it in GitHub Desktop.
#include <fstream.h>
ifstream fin("sir.txt");
void main() {
int x, k, a, b, c;
char cif;
fin >> x >> k;
if (x == 9) {
a = 1;
b = 2;
} else if (x < 9)
a = b = 1;
else
a = b = 2;
do {
c = a + b;
a = b;
b = c;
} while (c < k);
for (int i = 1; i <= a; i++) {
fin >> cif;
cout << cif;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment