Untitled
unknown
java
4 years ago
647 B
30
Indexable
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));
}
}
}Editor is loading...