Advertisement
palenda21

Untitled

Dec 11th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. double foo(double *px)
  6. {
  7. double sum = 0;
  8. for (int i = 1; i < 6; i++) {
  9. sum += exp(2 * cos(i * (*px))) * pow((*px), cos(i));
  10. }
  11. return sum;
  12. }
  13. int main()
  14. {
  15. double a = 0.25;
  16. for (double x = a; x < 0.81; x += 0.055) {
  17. cout << "x = " << x << " " << "sum = " << foo(&x) << endl;
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement