Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- using namespace std;
- int main()
- {
- float a1 =1, a;
- int n;
- cin >> n;
- cout << "a1=" << a1 << endl;
- for (int i = 2; i <= n; i++)
- {
- a = 0.25*(3*a1+(1/(3*a1)));
- cout << "a" << i << "=" << a << endl;
- a1 = a;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement