Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Enter the number of elements of the continued fraction: 6
- Solution - 1.61538
- #include <iostream>
- using namespace std;
- int main(){
- int n;
- double t;
- t=2;
- bool exit;
- while (exit != true) {
- printf("To exit the programs, type 0n");
- cout << "Enter the number of continued fractions: " << endl;
- cin >> n;
- if (n == 0) {
- exit = true;
- } else {
- if (n < 5) {
- printf("The number of elements of a fraction must be at least 5");
- cin.get();
- } else {
- for (int a = 1; a < n; a++) {
- t = 1 / t + 1;
- }
- cout << "Decision - " << t << endl;
- }
- }
- }
- printf("Exiting the program");
- return 0;
- }
Add Comment
Please, Sign In to add comment