fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. Scanner in = new Scanner(System.in);
  10. double x,n,s=0;
  11. n=in.nextDouble();
  12. x=in.nextDouble();
  13. for (int i=0; i<n; i++){
  14. s+=(x=Math.sin(x));
  15. }
  16. System.out.printf("S = %f",s);
  17. }
  18. }
Success #stdin #stdout 0.17s 321280KB
stdin
5 2 1 2 3 4 5
stdout
S=3.666140