fork download
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. double x,n,s=0;
  7. cin>>n>>x;
  8. for (int i=0; i<n; i++){
  9. s+=(x=sin(x));
  10. }
  11. cout<<"S="<<s;
  12. }
Success #stdin #stdout 0s 3460KB
stdin
5 2 1 2 3 4 5
stdout
S=3.66614