c2
This commit is contained in:
parent
0d75f30a49
commit
4744ebb565
69 changed files with 7 additions and 5 deletions
|
|
@ -1,24 +0,0 @@
|
|||
// ac_6_18.cpp
|
||||
// Горбацевич Андрей
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
|
||||
double inline funk(int i) {
|
||||
return 1./i;
|
||||
}
|
||||
|
||||
int main() {
|
||||
double eps;
|
||||
cout << "eps=";
|
||||
cin >> eps;
|
||||
int i = 1;
|
||||
double cur = funk(i);
|
||||
double prev = 1e6*1.;
|
||||
while (abs(cur-prev)>=eps) {
|
||||
prev = cur;
|
||||
cur = funk(++i);
|
||||
}
|
||||
cout << "a(i=" << i << ")=" << cur;
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue