Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- float suma(int, float);
- int main()
- {
- int n;
- float x;
- cin >> n;
- while (n < 0)
- {
- cin >> n;
- }
- cin >> x;
- cout << "Suma: " << suma(n, x) << endl;
- system("PAUSE");
- return 0;
- }
- float suma(int n, float x)
- {
- float sum = 0;
- for (int i = 1; i <= n; i++)
- {
- sum = sum + pow(sin(x),i);
- }
- return sum;
- }
Advertisement
Add Comment
Please, Sign In to add comment