c2
This commit is contained in:
parent
0d75f30a49
commit
4744ebb565
69 changed files with 7 additions and 5 deletions
25
1sem/adaptation courses/04/12.cpp
Normal file
25
1sem/adaptation courses/04/12.cpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// ac_4_12.cpp
|
||||
// Горбацевич Андрей
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
|
||||
double ak(double x, int k) {
|
||||
return sqrt(x*x + pow(sin(k*M_PI_4), 2));
|
||||
}
|
||||
|
||||
double sum(double x, int N) {
|
||||
double out = 0;
|
||||
for (int k = 1; k <= N; k++) {
|
||||
out += ak(x, k);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
int main() {
|
||||
double x;
|
||||
int N;
|
||||
cout << "x, N >>>";
|
||||
cin >> x >> N;
|
||||
cout << "S= " << sum(x, N) << endl;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue