Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- static double everything(double x) {
- if (-2 <= x && x <= 2) {
- x = x * x;
- } else if (x > 2) {
- x = 0;
- } else if (x < -2) {
- x = 4 * (Math.cos(x));
- }
- return x;
- }
- public static void main (String[]args){
- Scanner in = new Scanner(System.in);
- double x = in.nextInt();
- System.out.println(everything(x));
- }
- }
Add Comment
Please, Sign In to add comment