import java.util.*;
import java.io.*;
class Ideone
{
{
float x, y;
try(Scanner input
= new Scanner
(System.
in)) { System.
out.
println("Digite o valor de x: ");
try{
x = input.nextFloat();
y = (x - ((x* (x - 1)) / (2* x)));
System.
out.
println("valor calculado por F(x): " + y
);
} catch (InputMismatchException err) {
System.
out.
println("Erro! O valor digitado não é válido. Tente novamente!"); // err.printStackTrace();
}
}
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5pby4qOwoKY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewogICAgICAgIGZsb2F0IHgsIHk7CiAgICAgICAgCiAgICAgICAgdHJ5KFNjYW5uZXIgaW5wdXQgPSBuZXcgU2Nhbm5lcihTeXN0ZW0uaW4pKSB7CiAgICAgICAgCVN5c3RlbS5vdXQucHJpbnRsbigiRGlnaXRlIG8gdmFsb3IgZGUgeDogIik7CiAgICAgICAgCQogICAgICAgIAl0cnl7CiAgICAgICAgCQl4ID0gaW5wdXQubmV4dEZsb2F0KCk7CiAgICAgICAgCQkKICAgICAgICAJCXkgPSAoeCAtICgoeCogKHggLSAxKSkgLyAoMiogeCkpKTsKICAgICAgICAJCVN5c3RlbS5vdXQucHJpbnRsbigidmFsb3IgY2FsY3VsYWRvIHBvciBGKHgpOiAiICsgeSk7CiAgICAgICAgCQkKICAgICAgICAJfSBjYXRjaCAoSW5wdXRNaXNtYXRjaEV4Y2VwdGlvbiBlcnIpIHsKICAgICAgICAJCVN5c3RlbS5vdXQucHJpbnRsbigiRXJybyEgTyB2YWxvciBkaWdpdGFkbyBuw6NvIMOpIHbDoWxpZG8uIFRlbnRlIG5vdmFtZW50ZSEiKTsKICAgICAgICAJCS8vIGVyci5wcmludFN0YWNrVHJhY2UoKTsKICAgICAgICAJfQogICAgICAgIH0KCX0KfQ==