Untitled

mail@pastecode.io avatar
unknown
java
2 years ago
647 B
24
Indexable
Never
import java.util.Scanner;

public class demet {
    
    public static void main(String[] args) throws Exception {
        
        // ***** Ders 3 - Uygulama 2 -- f(x) Hesaplayan Program *****

        Scanner userInput = new Scanner(System.in);

        System.out.print("Lütfen 'x' değerini giriniz: " );
        double x = userInput.nextInt();

        if (x < 0) {
            System.out.println(((double) 2 / 3) * Math.abs(x - 1));
        }
        else if (x == 0) {
            System.out.println(Math.sqrt((double) 2 / 3));
        }
        else {
            System.out.println(((double) 2 / 3) * Math.abs(x + 1));
        }

    }
}