fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int n; //Количество вводимых чисел.
  13. Scanner sc = new Scanner(System.in);
  14. n = sc.nextInt();
  15. double a,f; //а-переменна для считывания чисел, f-произведения введенных чисел, m-результат из f умноженый на -1 в степени n+1.
  16. f=-1;
  17. for(int k=1; k<=n; ++k){
  18. a = sc.nextDouble();
  19. f *= -a;
  20. System.out.print(f);
  21. if(k<n)
  22. System.out.print(", ");
  23. else
  24. System.out.print(".");
  25.  
  26. }
  27. }
  28. }
Success #stdin #stdout 0.15s 321344KB
stdin
7
1.8
3.9
0.0001
-79
456.98
0.9001
4
stdout
1.8, -7.02, 7.02E-4, 0.055458, -25.34319684, 22.811411475684, -91.245645902736.