Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Main{
- public static void main(String[] args){
- double b = 0;
- Scanner scan = new Scanner(System.in);
- System.out.println("Введите sin какого угла вы хотите найти : ");
- double x = scan.nextDouble();
- for(double n = 0; n < 10; n+=2) {
- b += Math.pow(radian(x), n)/factorial(n);
- System.out.println(b);
- }
- }
- static double factorial(double n) {
- double fact = 1;
- for (double i = 1; i <= n; i++) {
- fact *= i;
- }
- return fact;
- }
- static double radian(double x){
- double a;
- a = (Math.PI * x)/180;
- return a;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment