Guest User

Untitled

a guest
Oct 1st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Main{
  4. public static void main(String[] args){
  5. double b = 0;
  6. Scanner scan = new Scanner(System.in);
  7. System.out.println("Введите sin какого угла вы хотите найти : ");
  8. double x = scan.nextDouble();
  9. for(double n = 0; n < 10; n+=2) {
  10. b += Math.pow(radian(x), n)/factorial(n);
  11. System.out.println(b);
  12. }
  13. }
  14. static double factorial(double n) {
  15. double fact = 1;
  16. for (double i = 1; i <= n; i++) {
  17. fact *= i;
  18. }
  19. return fact;
  20. }
  21. static double radian(double x){
  22. double a;
  23. a = (Math.PI * x)/180;
  24. return a;
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment