Advertisement
Masharapoport

bigmath

Aug 19th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. package com.company;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.  
  6.  public static int f1(int n) {
  7.         int z = 1;
  8.  
  9.         for (int i = 1; i <= n; i++) {
  10.             z = z * i;
  11.         }
  12.          return z;
  13.     }
  14.  
  15.     public static int f2(int n) {
  16.         int y = 1;
  17.         if (n % 2 == 0) {
  18.             for (int j = 1; j <= n - 1; j = j + 2) {
  19.                 y = y * j;
  20.  
  21.  
  22.             }
  23.         } else {
  24.             for (int k = 2; k <= n - 1; k = k + 2) {
  25.                 y = y * k;
  26.  
  27.             }
  28.  
  29.         }
  30.         return y;
  31.     }
  32.  
  33.     public static void main(String[] args) {
  34.         Scanner read=new Scanner(System.in);
  35.         int n = read.nextInt();
  36.         double t = f2(n)/(2*f1(n))+Math.sin(Math.tan(n))/(Math.log(f1(n)));
  37.         System.out.println (t);
  38.  
  39.         }
  40.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement