monkeyslut45

Кирилл Деменев

Nov 22nd, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     static double everything(double x) {
  8.  
  9.         if (-2 <= x && x <= 2) {
  10.             x = x * x;
  11.         } else if (x > 2) {
  12.             x = 0;
  13.         } else if (x < -2) {
  14.             x = 4 * (Math.cos(x));
  15.         }
  16.         return x;
  17.     }
  18.  
  19.         public static void main (String[]args){
  20.  
  21.             Scanner in = new Scanner(System.in);
  22.  
  23.             double x = in.nextInt();
  24.  
  25.             System.out.println(everything(x));
  26.         }
  27. }
Add Comment
Please, Sign In to add comment