Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<math.h>
- using namespace std;
- float suma(int, float);
- int main() {
- float x;
- int n;
- cout << "Unesite realan broj" << endl;
- cin >> x;
- cout << "Unesite prirodan broj" << endl;
- cin >> n;
- cout<<suma(n, x);
- system("pause>0");
- return 0;
- }
- float suma(int n, float x) {
- float broj = 0;
- float suma = 0;
- for (int i = 1; i <= n; i++) {
- broj = pow(x, i);
- suma = suma + cos(broj);
- }
- return suma;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement