Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- int n, k = 3, count = 0;
- double ak, ak_1 = 3, ak_2 = 2, ak_3 = 1, s = 0;
- cout<<"n = ";cin>>n;
- while(n<=3)
- {
- cout<<"n = ";cin>>n;
- }
- cout<<"k = ";cin>>k;
- do
- {
- ak=sin(3.14/k*ak_2) - ak_1;
- ak_3=ak_2;
- ak_2=ak_1;
- ak_1=ak;
- count++;
- k++;
- s += ak;
- }
- while(k<=n);
- s /= count;
- cout<<"SA = "<<s;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement